Positioning Method and Electronic Device

ABSTRACT

A positioning method includes calculating, based on data that is of collection points at a road edge and that is collected by a radar, a feature of a road on which a terminal device is actually located, determining, from a plurality of candidate roads based on the feature of the road on which the terminal device is actually located and features of the plurality of candidate roads, a target road matching original positioning coordinates of the terminal device, and correcting the original positioning coordinates using the target road, to obtain corrected positioning coordinates.

CROSS-REFERENCE TO RELATED APPLICATIONS

This is a continuation of U.S. patent application Ser. No. 17/357,229filed on Jun. 24, 2021, which is a continuation of International PatentApplication No. PCT/CN2019/124109 filed on Dec. 9, 2019, which claimspriority to Chinese Patent Application No. 201811601395.5 filed on Dec.26, 2018. All of the aforementioned patent applications are herebyincorporated by reference in their entireties.

TECHNICAL FIELD

The present disclosure relates to communications technologies, and morespecifically, to a positioning method and an electronic device.

BACKGROUND

Obtaining current vehicle location information through a positioningsystem is indispensable for manual driving, assisted driving, andautomatic driving, and provides strong support for decision-making andplanning. Map matching is one of important parts of the positioningsystem. A road that matches the vehicle location information is selectedfrom a plurality of roads on an electronic map, the vehicle locationinformation is corrected to the matched road, and the road on which auser is located is presented to the user such that the user learns acurrent location at which the user is located.

In an elevated road region, there is usually a case in which roads arestacked. As shown in FIG. 1, road stacking refers to a structure inwhich roads located at different spatial layers are roughly parallel ina horizontal direction, and an upper-layer road surface A and alower-layer road surface B partially or entirely overlap in a verticaldirection. In a drawing process of the electronic map, stacked roads atan upper layer and a lower layer are usually abstracted into two roadlines. As shown in FIG. 2, it can be seen from enlarged diagrams of aregion A and a region B in the figure that stacked roads in the region Aand the region B are similar in geometric shapes and close in geometriclocations. It is difficult to accurately distinguish, duringpositioning, a road on which a user is currently located. Therefore,precision of a provided positioning service is relatively low.

SUMMARY

Embodiments of this application provide a positioning method, toaccurately distinguish a road on which a user is currently located, andprovide a high-precision positioning service.

To achieve the objectives of the present disclosure, according to afirst aspect, an embodiment of this application provides a positioningmethod. The method includes obtaining coordinates of a terminal device,data of a plurality of collection points of a road divider, and featuresof a plurality of candidate roads, where the plurality of candidateroads are roads that are in map data and that are located in a firstrange of the coordinates of the terminal device, the road divider is anedge of a road on which the terminal device is located, and theplurality of collection points of the road divider are collection pointsobtained when a sensor collects the road divider. The road divider maybe a road edge, a road fence, a concrete pad, or a tree that is used todivide two roads. The sensor may be a radar, and may be amillimeter-wave radar.

The method further includes calculating, based on the data of theplurality of collection points of the road divider, a feature of theroad on which the terminal device is located, where the feature of theroad on which the terminal device is located is used to indicate achange in a shape of the road on which the terminal device is located,selecting a target road from the plurality of candidate roads based onthe feature of the road on which the terminal device is located and thefeatures of the plurality of candidate roads, and matching thecoordinates of the terminal device to the target road, to obtaincorrected coordinates of the terminal device. The coordinates of theterminal device may be original coordinates calculated based on apositioning signal received by the terminal device, or coordinatesobtained after the original coordinates are corrected, or coordinates ofthe terminal device at a current moment that are predicted based onpositioning coordinates of the terminal device in a historicalpositioning result.

The feature of the road on which the terminal device is located may beused to distinguish different roads, or may be used to distinguish roadtypes. An example in which the road edge is the road divider is used.The feature of the road may include a change degree of a slope of theroad edge, and may further include a change degree of a distance betweena road edge collection point and the terminal device. A road on whichthe terminal device is actually located, namely, the target road, may beaccurately selected from the plurality of candidate roads based on thecalculated feature of the road on which the terminal device is actuallylocated and the features of the plurality of candidate roads. Therefore,road matching is performed on the terminal device, and the coordinatesof the terminal device are matched to the target road. Coordinates ofprojected points of the coordinates of the terminal device on a linesegment representing the target road may be used as the correctedcoordinates of the terminal device that are obtained after the roadmatching.

In some possible implementations, the features of the plurality ofcandidate roads include types of the plurality of candidate roads. Theselecting a target road from the plurality of candidate roads based onthe feature of the road on which the terminal device is located and thefeatures of the plurality of candidate roads may include determining,based on the feature of the road on which the terminal device islocated, a type of the road on which the terminal device is located, andselecting the target road from the plurality of candidate roads based onthe type of the road on which the terminal device is located and thetypes of the plurality of candidate roads. The type of the road on whichthe terminal device is located is an elevated road or a non-elevatedroad, and the type of each of the plurality of candidate roads is anelevated road or a non-elevated road. In an elevated region scenario, apositioning service is affected by road stacking. Consequently, it isdifficult to accurately select, from the plurality of candidate roads,the road on which the terminal device is actually located. A type of theroad on which the terminal device is actually located may bedistinguished using the feature that is collected and calculated by thesensor and that is of the road on which the terminal device is located.The types of the plurality of candidate roads can be obtained fromcommon map data. Therefore, the target road can be accurately selectedin an elevated region, to provide a high-precision positioning service.

In some possible implementations, the determining, based on the featureof the road on which the terminal device is located, a type of the roadon which the terminal device is located includes determining, based onthe feature of the road on which the terminal device is located, a typeof an intersection at which the terminal device is located. The type ofthe intersection is an intersection of the elevated road or anintersection of the non-elevated road, and the intersection at which theterminal device is located is an intersection at which the terminaldevice is currently located. In a road stacking region, high-precisionpositioning may be obtained according to the positioning method providedin this application when the terminal device crosses an intersection ina moving process. This has a relatively wide range of applicationscenarios.

In some possible implementations, the determining, based on the featureof the road on which the terminal device is located, a type of the roadon which the terminal device is located includes, if the feature of theroad on which the terminal device is located meets a preset threshold,determining the type of the intersection at which the terminal device islocated. The type of the intersection is the intersection of theelevated road or the intersection of the non-elevated road.

In some possible implementations, the feature of the road on which theterminal device is located includes one or more of an average value ofslopes of the road divider at the plurality of collection points, avariance of the slopes of the road divider at the plurality ofcollection points, an average value of distances between the pluralityof collection points and the terminal device, and a variance of thedistances between the plurality of collection points and the terminaldevice.

In some possible implementations, the determining, based on the featureof the road on which the terminal device is located, a type of the roadon which the terminal device is located includes obtaining coordinatesof one or more moving targets collected by the sensor, where thecoordinates of the moving target are coordinates of the moving targetrelative to the sensor, calculating a movement feature of the one ormore moving objects based on the coordinates of the one or more movingobjects, where the movement feature is used to indicate a movement stateof the moving object, and determining, based on the movement feature ofthe one or more moving targets and the feature of the road on which theterminal device is located, the type of the road on which the terminaldevice is located. The movement feature may be one or more of a movementspeed of the one or more moving objects and a slope of a movement trackof the one or more moving objects.

In some possible implementations, the feature of the road on which theterminal device is located further includes a quantity of lanes of theroad on which the terminal device is located. The determining, based onthe feature of the road on which the terminal device is located, a typeof the road on which the terminal device is located includesdetermining, based on the quantity of lanes of the road on which theterminal device is located, whether the terminal device enters or leavesthe intersection of the elevated road, and if the terminal device entersor leaves the intersection of the elevated road, determining that thetype of the road on which the terminal device is located is the elevatedroad. A course angle is an included angle between a speed and the northpole of the earth. The quantity of lanes of the road on which theterminal device is located may be calculated based on a lane width and adistance between two road edges of the road on which the sensor and theterminal device are located.

In some possible implementations, the selecting the target road from theplurality of roads based on the type of the road on which the terminaldevice is located and the types of the plurality of roads includescalculating a matching degree between each of the plurality of roads andthe coordinates of the terminal device. A matching degree of a road thatis in the plurality of roads and that has a same type as the road onwhich the terminal device is located is greater than a matching degreeof a road that is in the plurality of roads and that has a differenttype from the road on which the terminal device is located. The targetroad is a road that is in the plurality of roads and that has a highestdegree of matching with the coordinates of the terminal device.

In some possible implementations, the determining, based on the featureof the road on which the terminal device is located, a type of the roadon which the terminal device is located includes, if the feature of theroad on which the terminal device is located is less than a firstthreshold, determining that the type of the intersection at which theterminal device is located is the intersection of the elevated road. Thefeature of the road on which the terminal device is located may be aplurality of features, and each feature has a first thresholdcorresponding to the feature.

In some possible implementations, the determining, based on the featureof the road on which the terminal device is located, a type of the roadon which the terminal device is located includes, if the feature of theroad on which the terminal device is located is greater than a secondthreshold, determining that the type of the intersection at which theterminal device is located is the intersection of the non-elevated road.

In some possible implementations, the road divider of the road on whichthe terminal device is located includes a first road divider and asecond road divider. The determining, based on the feature of the roadon which the terminal device is located, a type of the road on which theterminal device is located includes, if a difference between a featurethat is of the road on which the terminal device is located and thatcorresponds to the first road divider and a feature that is of the roadon which the terminal device is located and that corresponds to thesecond road divider is greater than a third threshold, determining thatthe type of the road on which the terminal device is located is theelevated road.

In some possible implementations, the movement feature of the one ormore moving objects is the movement speed of the one or more movingobjects. The determining, based on movement feature of the one or moremoving objects, a type of the road on which the terminal device islocated includes, if the movement speed of the one or more movingobjects is greater than a fourth threshold, determining that the type ofthe intersection at which the terminal device is located is theintersection of the non-elevated road.

In some possible implementations, the movement feature of the one ormore moving targets is the slope of the movement track of the one ormore moving targets. The determining, based on the movement feature ofthe one or more moving targets, the type of the intersection at whichthe terminal device is located includes, if the slope of the movementtrack of the one or more moving targets is less than a fifth threshold,determining that the intersection at which the terminal device islocated is the intersection of the non-elevated road.

In some possible implementations, the feature of each of the pluralityof candidate roads includes a quantity of lanes of each of the pluralityof candidate roads. The determining, based on the quantity of lanes ofthe road on which the terminal device is located, whether the terminaldevice enters or leaves the intersection of the elevated road includes,if the quantity of lanes of the road on which the terminal device islocated is greater than the quantity of lanes of each of the pluralityof candidate roads, determining that the type of the road on which theterminal device is located is the elevated road. The quantity of lanesthat is of each of the plurality of candidate roads and that is recordedin the map data does not include a ramp. In a ramp intersection regionon the elevated road, it is assumed that an actual quantity of lanes ofthe road is 5, and the quantity of lanes that is of the road and that isrecorded in the map data is 4. Therefore, the quantity of lanes of theroad on which the terminal device is located is calculated based on thedata collected by the sensor. If the calculated quantity of lanes on theroad on which the terminal device is located is greater than thequantity of lanes of each of the plurality of candidate roads, it may bedetermined that the terminal device is located on the elevated road.

In some possible implementations, the determining, based on the quantityof lanes of the road on which the terminal device is located, whetherthe terminal device enters or leaves the intersection of the elevatedroad includes, obtaining course angles of the terminal device at aplurality of moments, and if a variance of the course angles of theterminal device at the plurality of moments is greater than a sixththreshold, determining, based on the quantity of lanes of the road onwhich the terminal device is located, whether the terminal device entersor leaves the intersection of the elevated road.

According to a second aspect, an embodiment of this application providesan electronic device. The electronic device includes an obtainingmodule, a feature calculation module, a selection module, and a roadmatching module.

The obtaining module is configured to obtain coordinates of a terminaldevice, data of a plurality of collection points of a road divider, andfeatures of a plurality of candidate roads. The plurality of candidateroads are roads that are in map data and that are located in a firstrange of the coordinates of the terminal device. The road divider is anedge of a road on which the terminal device is located, and theplurality of collection points of the road divider are collection pointsobtained when a sensor collects the road divider.

The feature calculation module is configured to calculate, based on thedata of the plurality of collection points of the road divider, afeature of the road on which the terminal device is located. The featureof the road on which the terminal device is located is used to indicatea change in a shape of the road on which the terminal device is located.

The selection module is configured to select a target road from theplurality of candidate roads based on the feature of the road on whichthe terminal device is located and the features of the plurality ofcandidate roads.

The road matching module is configured to match the coordinates of theterminal device to the target road, to obtain corrected coordinates ofthe terminal device.

In some possible implementations, the selection module is furtherconfigured to determine, based on the feature of the road on which theterminal device is located, a type of the road on which the terminaldevice is located, and select the target road from the plurality ofcandidate roads based on the type of the road on which the terminaldevice is located and types of the plurality of candidate roads.

In some possible implementations, the selection module is furtherconfigured to determine, based on the feature of the road on which theterminal device is located, a type of an intersection at which theterminal device is located. The type of the intersection is anintersection of an elevated road or an intersection of a non-elevatedroad, and the intersection at which the terminal device is located is anintersection at which the terminal device is currently located.

In some possible implementations, the selection module is furtherconfigured to, if the feature of the road on which the terminal deviceis located meets a preset threshold, determine the type of theintersection at which the terminal device is located. The type of theintersection is the intersection of the elevated road or theintersection of the non-elevated road.

In some possible implementations, the obtaining module is furtherconfigured to obtain coordinates that are of one or more moving objectsand that are collected by the sensor. The coordinates of the movingobject are coordinates of the moving object relative to the sensor.

The feature calculation module is further configured to calculate amovement feature of the one or more moving targets based on thecoordinates of the one or more moving targets, where the movementfeature is used to indicate a movement state of the moving target.

The selection module is further configured to determine, based on themovement feature of the one or more moving targets and the feature ofthe road on which the terminal device is located, the type of the roadon which the terminal device is located.

In some possible implementations, the feature of the road on which theterminal device is located further includes a quantity of lanes of theroad on which the terminal device is located. The selection module isfurther configured to determine, based on the quantity of lanes of theroad on which the terminal device is located, whether the terminaldevice enters or leaves the intersection of the elevated road, and ifthe terminal device enters or leaves the intersection of the elevatedroad, determine that the type of the road on which the terminal deviceis located is the elevated road.

In some possible implementations, the selection module is furtherconfigured to calculate a matching degree between each of the pluralityof roads and the coordinates of the terminal device. A matching degreeof a road that is in the plurality of roads and that has a same type asthe road on which the terminal device is located is greater than amatching degree of a road that is in the plurality of roads and that hasa different type from the road on which the terminal device is located.The target road is a road that is in the plurality of roads and that hasa highest degree of matching with the coordinates of the terminaldevice.

In some possible implementations, the selection module is furtherconfigured to, if the feature of the road on which the terminal deviceis located is less than a first threshold, determine that the type ofthe intersection at which the terminal device is located is theintersection of the elevated road.

In some possible implementations, the selection module is furtherconfigured to, if the feature of the road on which the terminal deviceis located is greater than a second threshold, determine that the typeof the intersection at which the terminal device is located is theintersection of the non-elevated road.

In some possible implementations, the movement feature of the one ormore moving targets is a movement speed of the one or more movingtargets. The selection module is further configured to, if the movementspeed of the one or more moving targets is greater than a fourththreshold, determine that the type of the intersection at which theterminal device is located is the intersection of the non-elevated road.

In some possible implementations, the movement feature of the one ormore moving targets is a slope of a movement track of the one or moremoving targets. The selection module is further configured to, if theslope of the movement track of the one or more moving targets is lessthan a fifth threshold, determine that the intersection at which theterminal device is located is the intersection of the non-elevated road.

In some possible implementations, the feature of each of the pluralityof candidate roads includes a quantity of lanes of each of the pluralityof candidate roads. The selection module is further configured to, ifthe quantity of lanes of the road on which the terminal device islocated is greater than the quantity of lanes of each of the pluralityof candidate roads, determine that the type of the road on which theterminal device is located is the elevated road.

In some possible implementations, the obtaining module is furtherconfigured to obtain course angles of the terminal device at a pluralityof moments. The selection module is further configured to, if a varianceof the course angles of the terminal device at the plurality of momentsis greater than a sixth threshold, determine, based on the quantity oflanes of the road on which the terminal device is located, whether theterminal device enters or leaves the intersection of the elevated road.

According to a third aspect, an embodiment of this application providesan electronic device. The electronic device includes a sensor, aprocessor, and a computer-readable storage medium storing a computerprogram. The sensor is configured to collect data of a road divider andcoordinates of one or more moving targets. The processor is coupled tothe computer-readable storage medium. When the processor executes thecomputer program, the positioning method provided in any one of thefirst aspect and the possible implementations of the first aspect isimplemented.

According to a fourth aspect, an embodiment of this application providesa computer-readable storage medium. The computer-readable storage mediumstores a computer program, and when a processor executes the computerprogram, the positioning method provided in any one of the first aspectand the possible implementations of the first aspect is implemented.

According to a fifth aspect, an embodiment of this application providesa chip subsystem (SOC). The chip subsystem includes an applicationprocessor and a GPS module configured to receive a positioning signal,and the application processor is configured to implement the positioningmethod provided in any one of the first aspect and the possibleimplementations of the first aspect.

According to a sixth aspect, an embodiment of this application providesan electronic device. The electronic device includes the chip subsystemprovided in the fifth aspect and a sensor such that the electronicdevice can implement the positioning method provided in any one of thefirst aspect and the possible implementations of the first aspect. Thesensor is configured to collect data of a road divider and coordinatesof one or more moving targets.

According to a seventh aspect, an embodiment of this applicationprovides a positioning chip. The positioning chip includes a radiofrequency module and a processing module. The radio frequency module isconfigured to receive a positioning signal, and the processing module isconfigured to implement the positioning method provided in any one ofthe first aspect and the possible implementations of the first aspect.

According to an eighth aspect, an embodiment of this applicationprovides an electronic device. The electronic device includes thepositioning chip provided in the seventh aspect and a sensor such thatthe electronic device can implement the positioning method provided inany one of the first aspect and the possible implementations of thefirst aspect. The sensor is configured to collect data of a road dividerand coordinates of one or more moving objects.

According to a ninth aspect, an embodiment of this application providesa computer program product. The computer program product includes acomputer program, and when a processor executes the computer program,the positioning method provided in any one of the first aspect and thepossible implementations is implemented.

BRIEF DESCRIPTION OF DRAWINGS

FIG. 1 is a schematic diagram of road stacking according to anembodiment of the present disclosure.

FIG. 2 is a schematic road diagram of an electronic map according to anembodiment of the present disclosure.

FIG. 3 is a schematic structural diagram of a communications systemaccording to an embodiment of the present disclosure.

FIG. 4A is a schematic road diagram of an elevated region according toan embodiment of the present disclosure.

FIG. 4B is a schematic diagram of an electronic map of an elevatedregion according to an embodiment of the present disclosure.

FIG. 5 is a schematic structural diagram of a positioning systemaccording to an embodiment of the present disclosure.

FIG. 6 is a flowchart of a positioning method according to an embodimentof the present disclosure.

FIG. 7 is a schematic diagram of a road divider according to anembodiment of the present disclosure.

FIG. 8 is a schematic diagram of road matching according to anembodiment of the present disclosure.

FIG. 9 is a flowchart of a positioning method according to an embodimentof the present disclosure.

FIG. 10 is a schematic diagram of a vehicle body coordinate systemaccording to an embodiment of the present disclosure.

FIG. 11 is a flowchart of a positioning method according to anembodiment of the present disclosure.

FIG. 12 is a flowchart of a positioning method according to anembodiment of the present disclosure.

FIG. 13 is a schematic diagram of a quantity of lanes according to anembodiment of the present disclosure.

FIG. 14 is a flowchart of a positioning method according to anembodiment of the present disclosure.

FIG. 15 is a schematic diagram of an elevated road according to anembodiment of the present disclosure.

FIG. 16 is a schematic diagram of reflecting a feature of a road dividerin an intersection region of an elevated road according to an embodimentof the present disclosure.

FIG. 17 is a schematic diagram of a crossroad of a non-elevated roadaccording to an embodiment of the present disclosure.

FIG. 18 is a schematic diagram of reflecting a feature of a road dividerin a crossroad region of a non-elevated road according to an embodimentof the present disclosure.

FIG. 19 is a schematic diagram of a vehicle flow speed in a crossroadregion of a non-elevated road according to an embodiment of the presentdisclosure.

FIG. 20 is a schematic diagram of a vehicle flow speed in anintersection region of an elevated road according to an embodiment ofthe present disclosure.

FIG. 21 is a schematic diagram of a vehicle movement track in acrossroad region of a non-elevated road according to an embodiment ofthe present disclosure.

FIG. 22 is a schematic diagram of a vehicle movement track in acrossroad region of a non-elevated road according to an embodiment ofthe present disclosure.

FIG. 23 is a schematic diagram of a positioning precision map accordingto an embodiment of the present disclosure.

FIG. 24 is a schematic diagram of positioning points and correctedpositioning points in regions with different positioning precisionaccording to an embodiment of the present disclosure.

DESCRIPTION OF EMBODIMENTS

Some key terms in this application are explained below:

Global Positioning System (GPS) refers to an omnidirectional,round-the-clock, full-time, and high-precision satellite navigationsystem developed by the United States Department of Defense, can provideglobal users with low-cost and high-precision navigation informationsuch as three-dimensional locations, speeds, and precise timing, and isa typical application of satellite communications technologies in thenavigation field.

The global navigation satellite system (GNSS) refers to all satellitenavigation systems including global, regional, and enhanced satellitenavigation systems, for example, the GPS in the United States, theGLONASS in Russia, the Galileo in Europe, the BEIDOU satellitenavigation system in China, and related enhanced systems such as thewide region augmentation system in the United States, the Europeangeostationary navigation overlay service, and the multi-functionalsatellite augmentation system in Japan. The global navigation satellitesystem further includes other satellite navigation systems underconstruction and to be constructed in the future. The international GNSSsystem is a multi-system, multi-layer, multi-mode complex combinationsystem.

A vehicle navigation system (VNS) is an intelligent traffic system thatintegrates a vehicle positioning technology such as the GNSS, ageographic information system, and a computer technology.

Road stacking refers to a structure in which roads located at differentspatial layers are roughly parallel in a horizontal direction, and roadsurfaces overlap in a vertical direction.

An elevated road usually refers to an urban space road that is 6 meters(m) above the ground. Generally, the elevated road and a common road onthe ground constitute a multi-layer road system.

A millimeter-wave radar is a radar that works in a millimeter wave bandfor detection. Generally, a millimeter wave refers to an electromagneticwave in a frequency domain of 30 gigahertz (GHz) to 300 GHz (with awavelength between 1 millimeters (mm) and 10 mm). The wavelength of themillimeter wave is between a wavelength of a microwave and a wavelengthof a centimeter wave. Therefore, the millimeter-wave radar has someadvantages of both a microwave radar and a photoelectric radar.

Inertial measurement unit (IMU) is a triaxial gyroscope and a triaxialaccelerometer are mounted in one IMU, to measure angular speeds andaccelerations of an object in three-dimensional space, and calculate aposture of the object based on the angular speeds and the accelerations.To improve reliability, each axis may further be equipped with moresensors. Generally, the IMU needs to be mounted on the center of gravityof a to-be-measured object.

A vehicle body coordinate system is shown in FIG. 9. An origin of thevehicle body coordinate system is defined as a projected point of acenter of a rear axle of a vehicle on the horizontal ground, and therear axle of the vehicle is an axle between two rear wheels of thevehicle. An X axis (referred to as Veh_X axis) in the vehicle bodycoordinate system is a positive direction of a vehicle head, namely, thefront of the vehicle. A Y axis (referred to as a Veh_Y axis) of thevehicle body coordinate system is obtained by rotating 90 degreesanticlockwise along the Veh_X axis.

FIG. 3 is a communications system to which this application isapplicable. It should be noted that the system in FIG. 3 is merely anexample of a possible system, and a disclosed implementation solutionmay be implemented in any one of various systems based on a requirement.

As shown in FIG. 3, the system includes an electronic device 10, and mayfurther include a network 20, an electronic device 30, and a satellite40.

The electronic device 10 may receive a radio signal from the satellite40. The electronic device 10 may perform multi-source fusionpositioning, and perform positioning by combining one or morepositioning signals such as a satellite positioning signal, an inertialnavigation signal, a network positioning signal, and a positioningsignal of a sensor, for example, a laser or a radar. The electronicdevice 10 and the electronic device 30 may be communicatively connectedthrough the network 20, where the network 20 may be a wireless localarea network or a mobile network. A communication connection isestablished between the electronic device 10 and the electronic device30 based on a specific communications protocol, and then data istransmitted in a unit of a data packet based on the establishedconnection. In a transmission process, a data packet may pass throughone or more network devices in the network 20, for example, an accessnetwork device, a routing device, or an access point (AP).

The electronic device 10 may be a terminal device, and may be any one ofvarious types of computer systems or devices that are mobile or portableand that perform wireless communication. For example, the electronicdevice 10 may include a mobile phone or a smartphone (for example, aniPhone™-based or Android™-based phone), a vehicle-mounted terminaldevice, a portable game device (for example, Nintendo DS™, PlayStationPortable™ Gameboy Advance™ or the iPhone™), a laptop computer, apersonal digital assistant (PDA), a portable internet device, a musicplayer, a data storage device, another handheld device, and a wearabledevice, for example, a wristwatch, a headset, a pendant, or an earpiece.The electronic device 30 may be a terminal device or a server, and maybe a cloud server, a proxy server, or another server communicativelyconnected to a proxy server. In this embodiment provided in the presentdisclosure, the electronic device 30 may be a cloud server that providesfull road network data, and the electronic device 10 may request todownload and update map data from the cloud server 30 through thenetwork 20. A person skilled in the art may understand that onecommunications system may usually include fewer or more components thancomponents shown in FIG. 3, or include a component different from thecomponents shown in FIG. 3. FIG. 3 merely shows the components morerelated to a plurality of implementations disclosed in this embodimentof this application.

The electronic device 10 includes components such as a processor 101, amemory 102, an input/output interface 103, and a communicationsinterface 105. A person skilled in the art may understand that theelectronic device 10 may include more or fewer components than thoseshown in the figure, or combine some components.

These components may perform communication through one or more buses 106or signal lines. The bus may be classified into an address bus, a databus, a control bus, and the like.

The processor 101 may be a central processing unit (CPU), a networkprocessor (NP), or a combination of a CPU and an NP. The processor 101may further include a hardware chip. The hardware chip may be anapplication-specific integrated circuit (ASIC), a programmable logicdevice (PLD), or a combination of an application-specific integratedcircuit and a programmable logic device. The PLD may be a complexprogrammable logic device (CPLD), a field-programmable gate array(FPGA), generic array logic (GAL), or any combination thereof.Optionally, the processor 101 may include one or more processing units.

The memory 102 is configured to store computer programs, such as anapplication 107 and an operating system 108 that are shown in FIG. 3.The processor 101 may invoke the computer program stored in the memory102, to implement a function defined by the computer program. Forexample, the processor 101 executes the operating system 108, toimplement various functions of the operating system on the electronicdevice 10. The operating system 108 may be Linux®, Windows®, iOS®,Android®, or another operating system. This is not limited in thisembodiment of this application.

The memory 102 further stores other data in addition to the computerprograms, for example, data generated during running of the operatingsystem 108 and the application 107. The memory 102 may include avolatile memory, for example, a random-access memory (RAM). The memory102 may alternatively include a non-volatile memory, for example, aflash memory, a hard disk drive (HDD), or a solid-state drive (SSD). Thememory 102 may further include a combination of the foregoing types ofmemories. FIG. 3 shows only one memory. Certainly, the memory 102 mayalternatively be replaced by a plurality of storage devices based on arequirement. The memory 102 may be alternatively a memory in theprocessor 101. This is not limited herein.

The input/output interface 103 forwards a command or data that is inputusing an input/output device (for example, a keyboard, a touchscreen,and a sensor). The sensor may include one or more of sensors such as theradar, an inertial measurement unit, and the laser.

A display device 104 displays various types of information to a user. Inthis embodiment of the present disclosure, a final positioning result,namely, a road on which the electronic device 10 is located and alocation of the electronic device 10, is displayed on an interface of apositioning application.

The communications interface 105 is hardware configured to connect theelectronic device 10 to another electronic device, and allow theelectronic device 10 to communicate on a network. For example, thecommunications interface may be connected to the network in a wired orwireless manner to connect to another external terminal or server. Thewireless communication may use any communications standard or protocol,including but not limited to GPS, Global System for MobileCommunications (GSM), general packet radio service (GPRS), code-divisionmultiple access (CDMA), wideband code division multiple access (WCDMA),Long-Term Evolution (LTE), email, short messaging service (SMS), Wi-Fi,BLUETOOTH (BT), near-field communication (NFC), and the like. In aterminal device, the communications interface 105 may be a modem, anantenna, a Wi-Fi module, or a GPS module. The communications interface105 may alternatively be integrated with a processor and a memory(including a RAM and a read-only memory (ROM)).

An example in which the electronic device is a vehicle-mounted terminalis used. The vehicle-mounted terminal calculates original locationcoordinates based on a positioning signal. Because the original locationcoordinates are usually inaccurate, map matching needs to be performedbetween the original location coordinates and a road near the originallocation coordinates, to correct the original location coordinates. Whenperforming map matching based on the original location coordinates, thevehicle-mounted terminal needs to search the map data for roads locatedin a specific distance of the original location coordinates as candidateroads, selects, from the candidate roads, a road matching the originallocation coordinates, and may display information about the road on adisplay screen of the vehicle-mounted terminal, to display a road onwhich the user is currently located for the user. The map data recordsinformation about roads and intersections in a specific region, and mayfurther record some points of interest (POI), for example, landmarks orscenic spots in the region. The map data in a scenario of road stackingis shown in FIG. 4A. In a region shown in FIG. 4A, a location at whichthe vehicle-mounted terminal is actually located is a current locationA, and a first avenue 201 and a second avenue 202 intersect at anintersection 205. Both the first avenue 201 and the second avenue 202are located on a horizontal ground below an elevated road, and arenon-elevated roads. A third avenue 203 and a ramp 204 intersect at anintersection 206, are located above the elevated road, and are elevatedroads. In the map data, a schematic diagram of a road networkcorresponding to FIG. 4A is shown in FIG. 4B. Roads 31 to 36 are used toindicate real roads, and road intersections 37 and 38 are used toindicate intersections and indicate a connection relationship betweenroad lines. The roads and the road intersections constitute a roadnetwork topology. In the map data, the first avenue 201 is abstracted asthe road 31 and the road 32, the second avenue 202 is abstracted as theroad 33 and the road 34, the third avenue 203 is abstracted as the road35, and the ramp 204 is abstracted as the road 36. The intersections 205and 206 are respectively abstracted as the road intersections 38 and 37.A type of each road may be recorded in the map data. For example, a typeof the road 31 is recorded as a non-elevated road, and a type of theroad 35 is recorded as an elevated road. One or more of a road name of aroad line (for example, a name of the road 301 is the first avenue), anumber of the road line, coordinates of a start point and coordinates ofan end point of the road line, and coordinates of a road intersectionmay be further recorded. If the roads 31 to 36 are matchable candidateroads, when map matching is performed, it is difficult to accuratelydetermine a road line in which the vehicle-mounted terminal is actuallylocated. Therefore, a misjudgment occurs. For example, thevehicle-mounted terminal is actually located at the current location Aon the third avenue 203. However, a target road selected from thecandidate roads 31 to 36 according to an existing map matching method isthe road 32, and the current location displayed by the vehicle-mountedterminal to the user based on a target road line reflects that thevehicle-mounted terminal is on the first avenue 201. Therefore, in theroad stacking scenario, a positioning result is inaccurate, and userexperience is reduced. An existing method for determining whether acurrent road is an elevated road is mainly to determine whether thecurrent road is the elevated road by identifying uphill and downhillactions. For example, the uphill and downhill actions are identified byusing a change in tire pressure of rear wheels of a vehicle and avehicle inclination degree. However, a scenario in which the uphill anddownhill actions are not included in a traveling process cannot beprocessed. For example, after the vehicle-mounted terminal is restartedon the elevated road, whether a current road is an elevated road cannotbe determined, until a next uphill action location and a next downhillaction location appear. Therefore, real-time performance isinsufficient.

According to a positioning method provided in embodiments of thisapplication, upper and lower intersections of an elevated road oractions of entering or leaving an intersection are identified based on aroad feature and a feature of a surrounding vehicle that are collectedby a radar, to distinguish whether a type of a road on which a vehicleis currently located is an elevated road or a non-elevated road. Thiscan achieve round-the-clock road matching.

FIG. 5 is a schematic structural diagram of a positioning systemaccording to an embodiment of this application. The positioning systemmay be the foregoing electronic device 10. Specifically, the positioningsystem may be a vehicle navigation system. The positioning systemincludes an inertial measurement unit IMU 205, a GNSS module 206 (orreferred to as a GPS module), and a radar 207, and further includes amap-matching-based positioning module 209, a route guidance 210, a routeplanning 211, a map database 208, a GIS engine 212, and a displayinterface 213.

The radar 207 may be specifically a millimeter-wave radar. The radar 207may be configured to collect an object around a vehicle within acollection range of the radar. The object may specifically include astatic object around the vehicle (an ego vehicle), for example, a roaddivider, and moving objects around the vehicle, such as a moving vehicleand a moving pedestrian. The road divider is an edge of a road, and isused to distinguish two roads. Specifically, the road divider may be acement pier, a tree, a guardrail, a road edge, or the like. The IMU 205is configured to measure a course angle of the vehicle (the egovehicle). The GNSS module 206 is configured to calculate coordinates ofa current location of the vehicle (the ego vehicle) based on a receivedpositioning signal. Specifically, the coordinates may include longitudeand latitude coordinates. The map database 208 stores data of roads inone or more countries, one or more cities, or a specific region, and mayinclude one or more of coordinates of start points of the roads,coordinates of end points of the roads, coordinates of intersections,IDs of roads connected to the intersections, types of the roads, and aquantity of lanes of each of the roads. The map database 208 may belocated in a memory, or may be located in a cloud server communicativelyconnected to a positioning apparatus, and may periodically request thecloud server to update the data.

The map-matching-based positioning module 209 may be configured to usethe positioning method provided in the embodiments of this application.In a process of performing map matching based on map data provided bythe map database 208, a type of a road on which the vehicle is currentlylocated or a type of an intersection at which the vehicle is currentlylocated may be identified based on data provided by the IMU 205, theGNSS module 206, and the radar 207, to determine, from a plurality ofcandidate roads, a target road matching the current location of thevehicle, and provide an ID of the target road and information about aroad associated with the target road. The route guidance 210 queries andcompares the map data using information such as a road identifier (ID)generated by the map-matching-based positioning module 209, to obtain acomparison result between the current location of the vehicle and anexpected route provided by the route planning 211. The road on which thevehicle is currently located is presented using the display interface213, and a location of the vehicle is more accurately reflected. Forexample, in the scenario in FIG. 4A, if it is determined that the typeof the road on which the vehicle is currently located is an elevatedroad, the third avenue 203 is finally selected as a road that matchesthe original location coordinates, and the display interface 213indicates that the current location A of the vehicle is on the thirdavenue 203. Further, the vehicle navigation system may further prompt,using a real-time voice, that the road on which the vehicle is currentlylocated is the third avenue 203.

The following describes in detail the positioning method provided in theembodiments of this application. A flowchart of the method is shown inFIG. 6, and the method includes the following steps.

S1: Obtain coordinates of a terminal device, data of a plurality ofcollection points of a road divider, and features of a plurality ofcandidate roads.

The obtained coordinates of the terminal device may be originalcoordinates that may be calculated by the terminal device based on areceived positioning signal, and the original coordinates may have anerror due to blocking, reflection, or the like of a building.Alternatively, the obtained coordinates of the terminal device may becoordinates calculated based on original coordinates calculated duringprevious positioning and a movement speed of the terminal device.

Based on the coordinates of the terminal device, roads located in aspecific range of the coordinates of the terminal device may be searchedfor in map data. The roads may be roads located in a first range of thecoordinates of the terminal device, and the first range may be an errorrange of the original coordinates. These roads may be candidate roadsthat may match the coordinates of the terminal device in a map matchingphase. A circle may be made using the original coordinates as a centerand using the first range as a radius. In the map data, roads thatintersect the circle or are located in the circle are calculated as thecandidate roads. A feature of the candidate road may be obtained fromthe map data. The map data may include a type of the road, and mayfurther include one or more of coordinates of a start point of the road,coordinates of an end point of the road, an ID of the road, coordinatesof a road intersection (or referred to as an intersection), and aconnection relationship between roads. The type of the road may includean elevated road or a non-elevated road. The non-elevated road usuallyrefers to a road on the ground, and is used to distinguish from theelevated road. The elevated road may include a ramp between the elevatedroad and the non-elevated road, and may further include a connectionroad between a plurality of elevated roads.

The terminal device may obtain, from a sensor, data that is collected bythe sensor and that is of a static target and a moving target that arelocated in a specific distance of the terminal device. The sensor may bea radar, and may be a millimeter-wave radar. The static target may be aroad divider, for example, a road edge or a railing that is located inthe specific distance of the terminal device. The road divider is usedto divide two roads and is an edge of a road. The moving target may be apedestrian or a vehicle. As shown in FIG. 7, a vehicle 304 mounted witha sensor may detect, using the vehicle-mounted sensor, road dividers(for example, a road edge 301 and a road edge 302) of a road 303 onwhich the vehicle 304 is located. A plurality of collection points ofthe road divider are collection points obtained when the sensor collectsthe road divider, for example, a plurality of points 305 on the roadedge 301 and the road edge 302 in FIG. 7. When identifying that anobject at which the collection point is located is a static target or amoving target, the sensor may also calculate data of the collectionpoint, for example, coordinates of the collection point.

Step S2: Calculate, based on data of the plurality of collection pointsof the road divider, a feature of a road on which the terminal device islocated.

The feature of the road may be used to indicate a change in a shape ofthe road, and may be further used to indicate a total quantity of lanesof the road.

The road divider indicates the edge of the road and is used todistinguish any two roads. An example in which the road divider is theroad edge is used. The plurality of collection points of the roaddivider may be a plurality of collection points on one road edge, or maybe a plurality of collection points on each of two road edgesconstituting a road. The change in the shape of the road may beindicated by a change in a shape of the road edge, or may be indicatedby a difference between changes in shapes of two road edges constitutinga same road. The feature of the road may be obtained through calculationbased on a distance between the terminal device and the road divider ora slope of the road divider. The feature of the road may alternativelybe obtained through calculation based on a difference between distancesof a plurality of road dividers constituting the road or a differencebetween slopes of the plurality of road dividers constituting the road.

Step S3: Select a target road from the plurality of candidate roadsbased on the feature of the road on which the terminal device is locatedand the features of the plurality of candidate roads.

Changes in shapes of the plurality of candidate roads are different tosome extent. In other words, the candidate roads are distinguished usingthe features of the candidate roads. Therefore, the target road may beselected from the plurality of candidate roads based on a feature thatis actually collected and calculated by the sensor and that is of theroad on which the terminal device is located.

Optionally, a type of the road on which the terminal device is locatedis determined based on the feature of the road on which the terminaldevice is located. The target road is selected from the plurality ofroads based on the type of the road on which the terminal device islocated and types of the plurality of roads. The road on which theterminal device is located is a road on which the terminal device iscurrently located, and the type of the road may be the elevated road orthe non-elevated road. The feature of the road on which the terminaldevice is located may reflect an actual change in a road edge of theroad on which the terminal device is currently located. A type of a roadon which the terminal device is actually located may be determined basedon a value of the feature, to distinguish whether the road is anelevated road or a non-elevated road. For example, when the elevatedroad shown in FIG. 4B is stacked with a non-elevated road on the ground,a type of a road on which the current location A of the vehicle islocated may be determined based on a feature of the road, and the targetroad is selected from the plurality of candidate roads (the roads 31 to36).

Optionally, before step S3, the method may further include obtaining thetypes of the plurality of candidate roads. The types of the plurality ofcandidate roads may be obtained from the map data, and the map data maybe data stored in a map database. The map data may include the type ofthe road, and the type of the road may be the elevated road or thenon-elevated road.

In a possible implementation, a type of the selected target road is thesame as the type that is of the road on which the terminal device islocated and that is determined in the foregoing steps. In other words,the type of the road on which the terminal device is located may becompared with the types of the plurality of roads. A road whose type isthe same as the type of the road on which the terminal device is locatedis selected from the plurality of roads and the road is used as thetarget road. For example, if only a type of a road A in five candidateroads is the same as the type of the road on which the terminal deviceis located, the road A may be selected as the target road.

In another possible implementation, a matching degree between each ofthe plurality of candidate roads and the terminal device may becalculated. The matching degree may be obtained through weightedcalculation based on a plurality of influencing factors. A weightedvalue of each influencing factor may be set, and road type consistencymay be one of the influencing factors. The road type consistency is usedto indicate whether the type of the candidate road is the same as thatof the road on which the terminal device is located. Three influencingfactors A, B, and C are used as an example. k1 is a weight of theinfluencing factor A, k2 is a weight of the influencing factor B, and k3is a weight of the influencing factor C. A formula for calculating amatching degree K is K=A×k1+B×k2+C×k3. As shown in FIG. 4B, the roads 31to 36 are all candidate roads, and types of the roads 31 to 36 are foundin the map data. The types of the roads 31 to 34 are all non-elevatedroads, and the types of the roads 35 and 36 are all elevated roads. Ifit is determined, in step S3, that the type of the road on which theterminal device is located is an elevated road, for the road typeconsistency, a score of road type consistency of the road 35 and theroad 36 is greater than a score of road type consistency of the road 31to the road 34.

Optionally, features of some or all of the plurality of candidate roadsmay be further obtained, where the features of the candidate roads maybe features of the candidate roads calculated based on historical datacollected by the sensor. Optionally, the feature of the candidate roadmay be collecting, in an offline state, data of a plurality ofcollection points of a road divider of each road in a specific region,calculating a road feature of each road, and using the road and the roadfeature corresponding to the road as a part stored in the map database.Optionally, a feature parameter of the candidate road may alternativelybe, after the target road is determined according to steps S1 to S3, acalculated feature parameter of the road on which the terminal device islocated is used as a feature parameter corresponding to the target road,and is stored in the map database. In addition, the feature parametercorresponding to the target road may be further sent to a cloud servercommunicatively connected to the terminal device. A plurality ofterminal devices communicatively connected to the cloud server may send,to the cloud server, the target road and a feature parameter that is ofa road and that is collected by each of the plurality of terminaldevices. The cloud server may correct the received data, and then send,to each of the plurality of terminal devices, each of the plurality ofroads and a feature parameter corresponding to the road, to update acorrespondence that is between the road and the feature parameter andthat is stored in the terminal device.

For example, in a case of a multi-way intersection, a multi-wayintersection A is connected to roads 1 to 4, and geographical locationsof the roads 2 to 4 are close. When the vehicle moves from the road 1 tothe road 3 by crossing an intersection, because the geographicallocations of the roads 2 to 4 are close, when the target road isselected from the candidate roads 2 to 4 using, it may be shown that thevehicle is positioned on the road 2 or the road 4, but the vehicle isactually located on the road 3. Consequently, a relatively largepositioning error and relatively poor user experience are caused. Inthis embodiment of this application, a feature parameter of a road onwhich the vehicle is actually located may be calculated based on datathat is of the road divider and that is collected by the radar, and thetarget road is selected from the candidate roads 2 to 4 using thefeature parameter of the road on which the vehicle is actually located.

Step S4: Match the coordinates of the terminal device to the targetroad, to obtain corrected coordinates of the terminal device.

During map matching, coordinates of a projected point of the originalcoordinates on the target road is usually used as corrected originalcoordinates. As shown in FIG. 8, a projected point of an originalcoordinate point A on a target road 305 is A′. A straight line equationof the road 305 is y=kx+b. coordinates (x₀, y₀) of the point A, a methodfor calculating coordinates (x₁, y₁) of the projected point A′ is asfollows, calculating the coordinates of the projected point A′ of thepoint A, in other words, calculating a point at which a straight linethat is perpendicular to a straight line of the road 305 and thatcrosses the point A (x₀, y₀) intersects the road 305.

In another embodiment of this application, in the positioning method,the sensor needs to be used to identify a target around the terminaldevice, and collect data of the target. Whether a target in a specificrange of the terminal device is a static target or a moving target maybe identified. The static target may be a road divider, and the movingtarget may be a vehicle or a pedestrian. As shown in FIG. 9, thefollowing steps are included.

Step S101: Obtain a speed of the terminal device and a speed that is ofthe target and that is detected by the sensor.

The speed of the terminal device may be obtained through measurementusing an IMU on the terminal device. The speed that is of the target andthat is detected by the sensor may be obtained based on a change incoordinates that are of the target in a vehicle body coordinate systemand that are detected by the sensor in a specific time period. Anexample in which the terminal device is a vehicle and the sensor is amillimeter-wave radar is used. The vehicle body coordinate system isshown in FIG. 10. An origin of the vehicle body coordinate system isdefined as a projected point of a center of a rear axis of the vehicleon a horizontal ground, and the rear axis of the vehicle is an axlebetween two rear wheels of the vehicle. An X axis (referred to as aVeh_X axis) in the vehicle body coordinate system is a positivedirection of a vehicle head, namely, the front of the vehicle. A Y axis(referred to as a Veh_Y axis) of the vehicle body coordinate system isobtained by rotating 90 degrees anticlockwise along the veh_X axis. Apoint A in FIG. 10 is a target detected by a vehicle O mounted with amillimeter-wave radar. Herein, a difference of a distance between therear axis center of the vehicle and a location at which the radar ismounted on the vehicle is ignored. A speed of the vehicle O along theVeh_X axis is Vel_(x), and a speed of the vehicle O along the Veh_Y axisis Vel_(y). The millimeter-wave radar mounted on the vehicle O candetect that coordinates of a target A in the vehicle body coordinatesystem is (X_(veh), Y_(veh)). Due to the principle of the Dopplereffect, a speed (radial speed) that is of the target A in an AOdirection and that is provided by the millimeter-wave radar isVel_(radar) _(x) , a speed (tangential speed) in a direction of rotatingthe AO 90 degrees clockwise is Vel_(radar) _(y) , an AO distance is R,and an included angle between the AO and the Veh_X axis is 0. A speedVel_(veh_x) of the target A in a Veh_X axis direction in the vehiclebody coordinate system and a speed Vel_(veh_y) of the target A in aVeh_Y axis direction may be calculated according to the followingformula:

Vel _(veh_x) =Vel _(radar_x)*cos(θ)+Vel _(radar_y)*sin(θ)

Vel _(veh_y) =—Vel _(radar_x)*sin(θ)+Vel _(radar_y)*cos(θ)

Alternatively, the speed Vel_(veh_x) of the target A in the Veh_X axisdirection in the vehicle body coordinate system is calculated accordingto the following formula:

${Vel}_{veh\_ x} = {\sqrt{{Vel}_{radar\_ x}^{2} + {Vel}_{radar\_ y}^{2}}*{\cos\left( {\tan^{- 1}\left( \frac{Y_{veh}}{X_{veh}} \right)} \right)}}$

Step S102: Determine, based on the speed of the target and the speed ofthe terminal device, whether the target is a static target.

In an axle direction (the Veh_X axis direction), if a direction of thespeed Vel_(veh_x) of the target A is opposite to a direction of a speedVel_(x) of an ego vehicle (the vehicle O), and a difference betweenabsolute values of the speeds is less than a threshold Th_(static), thetarget A is a static target, otherwise, the target A is a moving target.The threshold Th_(static) may be 0.1 m/s.

∥Vel _(veh_x) |−|Vel _(x) ∥<Th _(static)

Step S103: Generate a fitted line of the road divider based on the dataof the plurality of collection points of the road divider.

After data of the plurality of collection points of the road dividerwithin a specific time period (a time period T) is obtained, the data ofall the collection points within the time period T may be converted intoa vehicle body coordinate system at a same moment, to obtain a point mapconstituted by the accumulated collection points of the road divider.Straight line fitting may be performed on the plurality of collectionpoints using a RANSAC method, to constitute the fitted line of the roaddivider. The fitted lines constitute a local map of the road on whichthe terminal device is actually located. As shown in FIG. 7, a fittedline in the local map may be used to indicate a shape of the roaddivider. For example, a fitted line 306 is used to indicate the roadedge 301, and may be used to calculate the feature of the road on whichthe terminal device is located. The data of the collection point may becoordinates of the collection point, and the coordinates may becoordinates in the vehicle body coordinate system.

Step S104: Calculate, based on the data of the plurality of collectionpoints of the road divider, the feature of the road on which theterminal device is located.

The feature of the road may be used to indicate the change in the shapeof the road, and the change in the shape of the road may be indicated bythe change in the shape of the road divider. The feature of the road maybe obtained through calculation based on the distance between theterminal device and the road divider, or may be obtained throughcalculation based on the slope of the road divider. The feature of theroad may include one or more of an average value of the slopes, avariance of the slopes, a variance of the distances, and an averagevalue of the distances. Shapes of road dividers on two sides of a sameroad are different, and differences between elevated roads anddifferences between non-elevated roads are different in magnitude.Therefore, a feature parameter may further include a difference betweenaverage values of respective slopes of a plurality of road dividers, adifference between variances of the respective slopes of the pluralityof road dividers, a difference between average values of respectivedistances of the plurality of road dividers, and a difference betweenvariances of the respective distances of the plurality of road dividers.

It can be seen from FIG. 4A that, in an intersection region, shapes ofroad edges of the elevated road and the non-elevated road are different,and changes in the shapes of the road edges are different to someextent. In addition, shapes or change degrees of road edges on two sidesof the elevated road are also greatly different from shapes or changedegrees of road edges on two sides of the non-elevated road. Therefore,a feature parameter of a road edge may be calculated based on data of aplurality of collection points of the road edge, and the featureparameter may be used to indicate a change in a shape of the road edge.

A feature of a road (the road 303) on which the vehicle O is located maybe calculated based on the data of the plurality of collection points(for example, an origin of the points 305 in FIG. 7 is the collectionpoint) of the road divider. The slope of the road divider may becalculated based on the data of the plurality of collection points ofthe road divider, or the distance between the road divider and theterminal device may be further calculated. The slope of the road dividermay be a slope of a fitted line at each collection point, the distancebetween the road divider and the terminal device may be a distancebetween the terminal device and the fitted line, and the distance is avertical distance. As shown in FIG. 7, the vehicle O travels on the road303, and the road edges of the road 303 are 301 and 302. The road 303includes three lanes, the three lanes are distinguished using lane lines308 and 309, and the vehicle O is actually located on a middle lane.Within the time period T, the sensor mounted on the vehicle O collects aplurality of collection points (for example, the points 305) on the roadedge 301 and the road edge 302. Round points are the collection pointson the road edges. For ease of presentation, only some collection pointsare shown in FIG. 7. The obtained data of the collection point may be adistance between the sensor and the collection point, or may becoordinates of the collection point in the vehicle body coordinatesystem. The fitted line 306 and a fitted line 307 are respectivelyfitted using the data of the plurality of collection points on the roadedge 301 and the road edge 302. The fitted line 306 is a fitted line onthe road edge 301, and the fitted line 307 is a fitted line on the roadedge 302. A point C is a foot of a perpendicular from a vehicle O pointto the fitted line 306, and a length & of OC is a distance between thevehicle O and the road edge 301. A point B is a foot of a perpendicularfrom the vehicle O point to the fitted line 307, and a length d_(R) ofOB is a distance between the vehicle O and the road edge 302. In amoving process of the vehicle O, a distance between the vehicle O andthe fitted line of the road divider at each moment may be calculated. Aslope k_(L), of the fitted line 306 at the point C is a slope of astraight line that crosses the point C and is tangent to the fitted line306, and the straight line that crosses the point C and is tangent tothe fitted line 306 is perpendicular to the OC. A slope k_(R) of thefitted line 307 at the point B is a slope of a straight line thatcrosses the point B and is tangent to the fitted line 307, and thestraight line that crosses the point B and is tangent to the fitted line307 is perpendicular to the OB.

Optionally, the feature of the road on which the terminal device islocated may include a quantity of lanes of the road on which theterminal device is located. A total quantity of lanes NUM_(lane_count)on the road on which the terminal device is located is calculated basedon a lane width and an intercept between each of the two road dividerson the road on which the terminal device is located and a location atwhich the terminal device is located, and a sequence number id_(lane) ofa current lane on which the terminal device is located may be furthercalculated.

${{Num}_{lane\_ count} = {{{Round}\left( \frac{d_{L}}{W_{Lane}} \right)} + {{Round}\left( \frac{d_{R}}{W_{Lane}} \right)} + 1}}{{id}_{lane} = {{{Round}\left( \frac{d_{L}}{W_{Lane}} \right)} + 1}}$

The lane width W Lane may be obtained according to a road trafficspecification, a navigation map, or visual detection. Round indicatescalculation rounding down. To be specific, an actually calculated valueis rounded down to a nearest integer (a direction that an absolute valuedecreases). As shown in FIG. 7, the distance between the vehicle O andthe left road edge 301 or the fitted line 306 is d_(L), the distancebetween the vehicle O and the right road edge 302 or the fitted line 307is d_(R), and a width of a single lane is W Lane. It may be obtainedthrough calculation that the sequence number id_(lane) of the currentlane is 2, and it may be obtained through calculation that the totalquantity of lanes Num_(lane_count) of the road 303 on which the vehicleO is located is 3.

Optionally, step S105 of calculating a feature of the moving target maybe included.

Based on a classification result of the static object or the movingobject in S102, M moving objects and speeds Vel_(veh_y) of the M movingobjects along the Veh_Y axis direction of the vehicle body coordinatesystem may be obtained. M is an integer greater than 0.

When the moving target is a vehicle, the feature of the moving targetmay indicate a motion feature of a vehicle flow. The feature of themoving target may indicate a speed of the vehicle, or may indicate amovement track of the vehicle. The feature of the moving target may becalculated based on a speed of at least one vehicle, or may becalculated based on a slope of a movement track of the at least onevehicle. The slope may be a slope of the vehicle in the vehicle bodycoordinate system of the vehicle in which the sensor is located.

Optionally, the feature of the moving target may be an average value ofthe speeds of the M moving targets in the Veh_Y axis direction. A speedof an i^(th) dynamic target of the M moving targets in the Veh_Y axisdirection of the vehicle body coordinate system is denoted as Vel_(veh)_(y) ^(i), where i is an integer greater than 0 and less than or equalto M, and an average value Vel_(veh) _(y) of the speeds of the M movingtargets in the Veh_Y axis direction is:

$\overset{\_}{{Vel}_{{veh}_{y}}} = {\sum\limits_{M}^{i = 1}{❘{Vel}_{{veh}_{y}}^{i}❘}}$

In another possible implementation, the feature of the moving target maybe a minimum speed of the speeds of the M moving targets in the Veh_Yaxis direction.

Optionally, the feature of the moving target may be obtained throughcalculation based on slopes of movement tracks of the M moving targets.In an implementation, the feature of the moving target may be a maximumslope of the slopes of the movement tracks of the M moving targets.Within the time period T (a moment t−T to a moment t), the sensor tracksthe M moving objects, where M is an integer greater than 0. At themoment t−T, coordinates of the i^(th) moving target in the vehicle bodycoordinate system at the moment t−T are (X_(obj) _(i) ^(t-T), Y_(obj)_(i) ^(t-T)). At the moment t, coordinates of the i^(th) moving targetin the vehicle body coordinate system at the moment t are (X_(obj) _(i)^(t), Y_(obj) _(i) ^(t)). i is an integer greater than 0 and less thanor equal to M. The vehicle body coordinate system at the same moment(the moment t or the moment t−T) is switched to. Within the time periodT, coordinates of a start point of the i^(th) moving target are (X_(veh)⁰, Y_(veh) ⁰) coordinates of an end point of the i^(th) moving targetare (X_(veh) ^(T), Y_(veh) ^(T)), and a slope of a movement track of thei^(th) moving target is a slope k_(i) of a connecting line between thestart point and the end point of the i^(th) moving target:

$k_{i} = \frac{X_{veh}^{T} - X_{veh}^{0}}{Y_{veh}^{T} - Y_{veh}^{0}}$

Optionally, the M moving targets may be traversed, and a maximum slopek_(max) of slopes of connecting lines between start points and endpoints of the M moving targets in the vehicle body coordinate system is:

k _(max)=max{k _(i)} (i=1,2, . . . ,M)

In another implementation, a feature parameter of the moving target maybe the average value of the slopes of the movement tracks of the Mmoving targets.

In another implementation, the feature of the moving target mayalternatively be a minimum slope of the slopes of the movement tracks ofthe M moving targets.

After the feature of the road on which the terminal device is located isobtained, the type of the road on which the terminal device is locatedmay be determined based on the feature of the road. Then, the targetroad is selected from the plurality of candidate roads based on the typeof the road on which the terminal device is located and the types of theplurality of candidate roads. As shown in FIG. 11, the following stepsmay be included.

Step S200: Determine that the terminal device is within an intersectionrange.

This step is optional. The plurality of candidate roads are traversed todetermine whether the terminal device enters an intersection range of acurrent candidate road.

Determining within the intersection range. Query is performed based onan electronic map tile number Mesh_Id_(i) and a road number Road_Id_(i)of an i^(th) candidate road Rd_(i), to obtain information about thecandidate road Rd_(i). The information about the candidate road mayinclude a type of the candidate road, and may further includecoordinates of a start point of the candidate road, coordinates of anend point of the candidate road, and whether the start point or endpoint of the candidate road is connected to an intersection. If thecurrent candidate road is connected to the intersection, this process iscontinued. If the current candidate road is not connected to theintersection, a next candidate road is selected for re-determining.

$d_{I} = \sqrt[2]{\left( {X^{\prime} - {{Rd}_{i} \cdot {EP} \cdot x}} \right)^{2} + \left( {Y^{\prime} - {{Rd}_{i} \cdot {EP} \cdot y}} \right)^{2}}$

In the foregoing formula, a distance d₁ between a current vehicle andthe intersection is calculated based on endpoint coordinates(Rd_(i)·EP·x, Rd_(i)·EP·y) of the candidate road and originalcoordinates (X′, Y′) of a current terminal device, where an endpointindicates the intersection.

d ₁ <Th _(in_I)

In the foregoing formula, Th_(in_I) is a distance threshold fordetermining whether the terminal device is within the intersectionrange. If the foregoing formula is true, the terminal device is withinthe intersection range, and the following steps are performed. If theforegoing formula is not true, the next candidate road is selected forre-determining.

Step S201: Identify a type of the intersection

The type of the intersection at which the terminal device is located isidentified based on the feature of the road such that the type of theroad on which the terminal device is located can be determined. The typeof the road may be an elevated road or a non-elevated road, and the typeof the intersection may be an intersection of the elevated road or anintersection of the non-elevated road. When the terminal device crossesan intersection in a moving process, a type of the intersection may beidentified.

Optionally, step S202 of identifying an action of entering or leaving aramp may be further included.

Whether the terminal device has the action of entering or leaving a rampis identified based on the feature of the road on which the terminaldevice is located. The ramp exists only at the intersection of theelevated road. Therefore, if the terminal device has the action ofentering or leaving a ramp, it is determined that the type of theintersection at which the terminal device is located is the intersectionof the elevated road, and the type of the road on which the terminaldevice is located is the elevated road. If the terminal device does nothave the action of entering or leaving a ramp, step S201 may beperformed.

Step S204: Select the target road.

The target road is selected from the plurality of candidate roads basedon the types of the plurality of candidate roads and the type of theroad on which the terminal device is located, and an ID of the targetroad is output. Specific details have been described in the foregoingstep S3, and details are not described herein again.

As shown in FIG. 12, the step 202 of identifying the action of enteringor leaving a ramp may include the following steps.

Optionally, before step S303, steps S301 and S302 may be included.

S301: Calculate a variance of course angles within the time period T.

An example in which the terminal device is a vehicle is used, andchanges in course angles Yaw of the vehicle within the time period T arecalculated. A variance σ_(Yaw) of the course angles within the timeperiod T is calculated. The course angle Yaw is an included anglebetween a direction of the head of the vehicle and a direction of thenorth of a map along a clockwise direction.

S302: Determine whether the variance of the course angles is greaterthan a sixth threshold.

σ_(Yaw) >Th _(Yaw_std)

In the foregoing formula, the sixth threshold Th_(Yaw_std is) athreshold of the variance of the course angles. When σ_(Yaw) is greaterthan the sixth threshold Th_(Yaw_std), to be specific, the vehicleperforms an action of changing a lane, there is a possibility ofentering or leaving the ramp. A value of Th_(Yaw_std) may be 0.15 rad.

If the variance of the course angles is greater than the sixththreshold, the step S303 may be performed. If the variance of the courseangles is less than or equal to the sixth threshold, it is determinedthat the terminal device does not have the action of entering or leavinga ramp.

S303: Determine whether the quantity of lanes of the road on which theterminal device is located is greater than a quantity of lanes of eachof the candidate roads.

The map data stores the quantity of lanes of the road. For arelationship between the quantity of lanes of the road in the map dataand an actual quantity of lanes of the road, refer to FIG. 13. It can beseen from FIG. 13 that, in the quantity of lanes that is of the road andthat is stored in the map data, a temporary new lane of anon-ramp/off-ramp region is not considered. For example, a lane numbered5 is the temporary new lane of the on-ramp/off-ramp region. Therefore,in this region, a quantity of lanes that is of the road and that isstored in the map data is less than an actual quantity of lanes of theroad. If the quantity of lanes Num_(lane_count) that is of the road onwhich the vehicle is located and that is calculated based on the featureof the road on which the vehicle is located in S104 is greater than thequantity of lanes Map_(lane_count) that is of the candidate roads andthat is obtained from the map data, the vehicle is located in theon-ramp/off-ramp intersection region on the elevated road, the vehiclehas the action of entering or leaving a ramp, and the type of the roadon which the vehicle is located is the elevated road. Alternatively, ifthe sequence number id_(lane) that is of the lane on which the vehicleis located and that is calculated based on the feature of the road onwhich the vehicle is located in S104 is greater than the quantity oflanes Map_(lane_count) on the navigation map, the vehicle is located inthe on-ramp/off-ramp region on the elevated road, the vehicle has theaction of entering or leaving a ramp, and the road on which the vehicleis located is an elevated road.

Optionally, whether the vehicle has the action of entering or leaving aramp is determined for a plurality of times at a plurality of momentsusing steps S301 to S303. If it is determined for N times whether thevehicle enters or leaves the ramp, and determining results for n timesare that the vehicle has the action of entering or leaving a ramp,R_(in_out_ramp)=n/N, where R_(in_out_ramp) indicates a proportion of thedetermining results that the vehicle has the action of entering orleaving a ramp. If the proportion of the determining results that thevehicle has the action of entering or leaving a ramp is greater than athreshold, it is determined that the vehicle has the action of enteringor leaving a ramp:

R _(in_out_ramp) >Th _(percentage_in_out_ramp)

Th_(percentage_in_out_ramp) is the threshold for determining that thevehicle has the action of entering or leaving a ramp.

As shown in FIG. 14, the step 201 of identifying the type of theintersection may include the following steps.

S404: Calculate the feature of the road on which the terminal device islocated.

The feature of the road may be used to indicate the change in the shapeof the road, and the change in the shape of the road may be indicated bythe change in the shape of the road divider. The feature of the road maybe obtained through calculation based on the distance between theterminal device and the road divider, or may be obtained throughcalculation based on the slope of the road divider. The feature of theroad may include one or more of the average value of the slopes, thevariance of the slopes, the variance of the distances, and the averagevalue of the distances. For calculation methods of the slope and thedistance, refer to the foregoing step 104, and details are not describedherein again.

Based on data that is of the road dividers and that is collected by thesensor within the time period T, the slopes of the road dividers on thetwo sides of the road and the distances between the terminal device andthe road dividers are calculated, and an average value of slopes of theroad dividers on each of the two sides, a variance of the slopes of theroad dividers on each of the two sides, an average value of distancesbetween the terminal device and the road dividers on each side, and avariance of the distances between the terminal device and the roaddividers on each side are calculated. Road dividers on the left andright sides of the road are used as an example. An average value ofdistances between the road dividers on the left side and the terminaldevice is μ_(D) _(L) , a variance of the distances between the roaddividers on the left side and the terminal device is σ_(D) _(L) , anaverage value of slopes of the road dividers on the left side is μ_(K)_(L) , and a variance of the slopes of the road dividers on the leftside is σ_(K) _(L) . An average value of distances between the roaddividers on the right side and the terminal device is μ_(D) _(R) , avariance of the distances between the road dividers on the right sideand the terminal device is σ_(D) _(R) , an average value of slopes ofthe road dividers on the right side is μ_(K) _(R) , and a variance ofthe slopes of the road dividers on the right side is σ_(K) _(R) .

FIG. 15 and FIG. 16 may vividly present changes in slopes of roaddividers in a ramp intersection region of the elevated road. FIG. 17 andFIG. 18 may vividly present changes in slopes of road dividers of acrossroad region (the intersection of the non-elevated road). Blackarrows in FIGS. 16 and 18 represent slopes at collection points of theroad dividers.

FIG. 15 shows a ramp intersection of the elevated road, and a type ofthe road is an elevated road. As a vehicle travels north (from bottom totop in the figure), changes in distances between left and right roadedges and the vehicle and changes in slopes of the left and right roadedges can be clearly reflected in the figure. Locations of the vehicleat six moments are respectively P1, P2, P3, P4, P5 and P6. A line 503 isused as an example. The line 503 represents a line that is perpendicularto a perpendicular line from the P4 to a road edge 502 when the vehicleis located at the P4, and a slope of the line 503 in the vehicle bodycoordinate system may be a slope of the road edge corresponding to theP4. At the six moments, a slope of a left road edge 501 and a distance &between the left road edge 501 and the vehicle almost remain unchanged.For a slope of the right road edge 502 and a distance d_(R) between theright road edge 502 and the vehicle, as the vehicle approaches approachthe ramp intersection region, absolute values of k_(R) ₁ to k_(R) ₄increase, and absolute values of k_(R) ₄ and k_(R) ₅ decrease. Absolutevalues of d_(R) ₁ to d_(R) ₅ gradually increase. When the vehicle is faraway from a ramp, an absolute value of d_(R) ₆ decreases suddenly andapproaches d_(R) ₁ .

FIG. 17 shows a crossroad, and a type of the road is a non-elevatedroad. As a vehicle travels north (from bottom to top in the figure),changes in distances between and left and right road edges and thevehicle and changes in slopes of the left and right road edges can beclearly reflected in the figure. Locations of the vehicle at eightmoments are respectively P1, P2, P3, P4, P5, P6, P7, and P8. A line 503is used as an example. The line 503 represents a line that isperpendicular to a perpendicular line from the P4 to a road edge 502when the vehicle is located at the P4, and a slope of the line 503 inthe vehicle body coordinate system may be a slope of the road edgecorresponding to the P4. A slope of a left road edge 501 and a distance& between the left road edge and the vehicle almost remain unchanged.For a slope of the right road edge 502 and a distance d_(R) between theright road edge and the vehicle, as the vehicle approaches thecrossroad, absolute values of k_(R) ₁ to k_(R) ₄ gradually increase, anabsolute value of k_(R4) gradually approaches infinity, and absolutevalues of k_(R) ₅ to k_(R) ₈ gradually decrease.

S405: Determine whether the feature of the road is greater than a secondthreshold.

It can be learned from the foregoing descriptions that slopes of roaddividers on left and right sides of an intersection region of thenon-elevated road change more sharply than slopes of road dividers onleft and right sides of the ramp intersection region of the elevatedroad. Distances between the road dividers on the left and right sides ofthe intersection region of the non-elevated road and the terminal devicechange more sharply than distances between the road dividers on the leftand right sides of the ramp intersection region of the elevated road andthe terminal device. Therefore, it is determined whether the feature ofthe road meets a condition. Corresponding thresholds may be set fordifferent road features. If a value of any feature of the average valueof the slopes of the road dividers, the variance of the slopes of theroad dividers, the average value of the distances between the roaddividers and the terminal device, and the variance of the distancesbetween the road dividers and the terminal device is greater than athreshold corresponding to the feature, it is determined that theintersection at which the terminal device is located is the intersectionof the non-elevated road, for example, a crossroad on the ground, andthe type of the road on which the terminal device is located is thenon-elevated road. If a value of any feature of the average value of theslopes of the road dividers, the variance of the slopes of the roaddividers, the average value of the distances between the road dividersand the terminal device, and the variance of the distances between theroad dividers and the terminal device is less than a thresholdcorresponding to the feature, it is determined that the intersection atwhich the terminal device is located is the intersection of the elevatedroad, for example, the ramp intersection, and the type of the road onwhich the terminal device is located is the elevated road.

It is determined whether a plurality of features of the road on whichthe terminal device is located are greater than second thresholdscorresponding to the features. The second threshold is a threshold of aroad feature of the intersection region of the non-elevated road, andspecific values of the second thresholds corresponding to all thefeatures may be different or may be the same. An example in which thenon-elevated road is located in a crossroad region is used. It can beseen from FIG. 17 that a change in a road edge of the crossroad isclear. When the vehicle crosses the crossroad, it is clear that both theslopes of the left and right road edges and distances between the leftand right road edges and the vehicle change. Therefore, when any one ofthe plurality of features of the road on which the terminal device islocated is greater than a threshold corresponding to the feature, it isdetermined that the vehicle is located in the intersection region of thenon-elevated road.

σ_(D) _(L) >Th_(down_distance_std)

μ_(D) _(L) >Th_(down_distance_mean)

σ_(K) _(L) >Th_(down_stop_std)

μ_(K) _(L) >Th_(down_stop_mean)

σ_(D) _(R) >Th_(down_distance_std)

μ_(D) _(R) >Th_(down_distance_mean)

σ_(K) _(R) >Th_(down_stop_std)

μ_(K) _(R) >Th_(down_stop_mean)

Th_(down_distance_std), Th_(down_distance_mean), Th_(down_stop_std) andTh_(down_stop_mean) are respectively a threshold corresponding to avariance of distances between the road dividers in the intersectionregion of the non-elevated road and the terminal device, a thresholdcorresponding to an average value of the distances between the roaddividers in the intersection region of the non-elevated road and theterminal device, a threshold corresponding to a variance of the slopesof the road dividers in the intersection region of the non-overheadroad, and a threshold corresponding to an average value of the slopes ofthe road dividers in the intersection region of the non-overhead road.The threshold may be a value obtained by measuring and collectingstatistics on an actual road. When any one of the plurality of featuresof the road exceeds the corresponding threshold, it is output that thetype of the road on which the terminal device is located is thenon-elevated road.

Optionally, S406 of determining whether the feature of the road is lessthan a first threshold is further included.

If each of the features of the road on which the terminal device islocated is less than or equal to the second threshold corresponding toeach feature, it is determined whether each of the plurality of featuresof the road on which the terminal device is located is less than a firstthreshold corresponding to the feature. The first threshold is athreshold of a road feature of the intersection region of the elevatedroad. Specific values of the first thresholds corresponding to thefeatures may be different or may be the same, and the first thresholdcorresponding to each feature is less than the second thresholdcorresponding to the feature. It can be seen from FIG. 15 that thefeature of the road of the intersection region of the elevated roadchanges slowly. Therefore, it is determined, using the followingformula, whether an intersection at which the vehicle approaches is theintersection of the elevated road:

σ_(D) _(L) >Th_(up_distance_std)

μ_(D) _(L) >Th_(up_distance_mean)

σ_(K) _(L) >Th_(up_slop_std)

μ_(K) _(L) >Th_(up_slop_mean)

σ_(D) _(R) >Th_(up_distance_std)

μ_(D) _(R) >Th_(up_distance_mean)

σ_(K) _(R) >Th_(up_slop_std)

μ_(K) _(R) >Th_(up_slop_mean)

Th_(up_distance_std), Th_(up_distance_mean), Th_(up_distance_std) andTh_(up_slop_mean) are respectively a threshold corresponding to avariance of distances between the road dividers in the intersectionregion of the elevated road and the terminal device, a thresholdcorresponding to an average value of the distances between the roaddividers in the intersection region of the elevated road and theterminal device, a threshold corresponding to a variance of the slopesof the road dividers in the intersection region of the elevated road,and a threshold corresponding to an average value of the slopes of theroad dividers in the intersection region of the elevated road. When eachof the plurality of features of the road on which the terminal device islocated is less than the corresponding second threshold, it may beoutput that the road on which the terminal device is located is theelevated road.

Optionally, when each of the plurality of features of the road on whichthe terminal device is located is less than the corresponding secondthreshold, S407 may be performed to determine, for one of the pluralityof features, whether a difference between the features of the roaddividers on the two sides is greater than a third threshold. The thirdthreshold is used to indicate a threshold of the difference between thefeatures of the road dividers on the two sides of the elevated road.

It can be seen from FIG. 15 that when the vehicle crosses theintersection of the elevated road, a difference between the slopes ofthe road edges on the two sides and a difference between the distancesbetween the road edges on the two sides and the vehicle change slowly.Therefore, whether the vehicle is located at the intersection of theelevated road is determined based on a value difference between featuresof the road edges on the two sides:

|μ_(K) _(L) −μ_(K) _(R) |>Th _(diff_slop_mean)

|μ_(D) _(L) −μ_(D) _(R) |>Th _(diff_dis_mean)

|σ_(D) _(L) −σ_(D) _(R) |>Th _(diff_dis_std)

|σ_(K) _(L) −σ_(K) _(R) |>Th _(diff_slop_std)

Th_(diff_dis_mean), Th_(diff_dis_std), Th_(diff_slop_mean), andTh_(diff_slop_dis) are respectively a threshold corresponding to adifference between average values of distances between the road dividerson the two sides and the terminal device, a threshold corresponding to adifference between variances of the distances between the road dividerson the two sides and the terminal device, a threshold corresponding to adifference between average values of slopes of the road dividers on thetwo sides, and a threshold corresponding to a difference betweenvariances of the slopes of the road dividers on the two sides. When thedifference of the distances between the left and right road edges or thedifference of the slopes between the left and right road edges exceedsthe threshold, it indicates that the road on which the terminal deviceis currently located is an elevated road.

Before step S404, step S401 of calculating the feature of the movingtarget may be further included.

The feature of the moving object is a motion feature of the movingobject. The feature of the moving object may be indicated by a speed ofthe moving object, may be indicated by a movement track of the movingobject, or may be indicated by a slope of a movement track of the movingobject.

Optionally, the feature of the moving target may be obtained throughcalculation based on a speed Vel_(veh) _(y) of the moving target in atransverse direction, and, may be the speed of the moving target in thetransverse direction, or may be an average value Vel_(veh) _(y) ofspeeds of a plurality of moving targets in the transverse direction. Thefeature of the moving object may alternatively be the slope of themovement track of the moving object. For specific calculation, refer tostep 105, and the details are not described herein.

For example, as shown in FIG. 19, a vehicle Ego is the foregoingterminal device, and may be mounted with a sensor, for example, amillimeter-wave radar. The vehicle Ego is on a non-elevated road and islocated in a crossroad region. In step 102, the vehicle Ego identifiesthree moving targets, a vehicle A, a vehicle B, and a vehicle C.According to calculation in step 101, speeds Vel_(veh_y) of the vehicleA, the vehicle B, and the vehicle C in the Veh_Y axis direction of thevehicle body coordinate system are respectively Vel_(veh_y) ^(A),Vel_(veh_y) ^(B), and Vel_(veh_y) ^(C). An average value of the speedsof the three moving objects (the vehicle A, the vehicle B, and thevehicle C) in the Veh_Y axis direction of the vehicle body coordinatesystem is calculated. In other words, an average value of Vel_(veh_y)^(A), Vel_(veh_y) ^(B), and Vel_(veh_y) ^(C) is calculated.

As shown in FIG. 20, a vehicle Ego is the foregoing terminal device, andmay be mounted with a sensor, for example, a millimeter-wave radar. Thevehicle Ego is on an elevated road and is located in a ramp intersectionregion. In step 102, the vehicle Ego identifies two moving targets, avehicle D and a vehicle E. According to calculation in step 101, speedsVel_(veh_y) of the vehicle D and the vehicle E in the Veh_Y axisdirection of the vehicle body coordinate system are respectivelyVel_(veh) _(y) ^(E) and Vel_(veh) _(y) ^(D). An average value of thespeeds of the two moving targets (the vehicle D and the vehicle E) inthe Veh_Y axis direction of the vehicle body coordinate system iscalculated. In other words, an average value of Vel_(veh) _(y) ^(E) andVel_(veh) _(y) ^(D) is calculated.

Optionally, the feature of the moving object may be the slope of themovement track of the moving object, and the slope may be calculatedbased on a start point and an end point of the movement track.

For example, as shown in FIG. 21, a vehicle Ego is the foregoingterminal device, and may be mounted with a sensor, for example, amillimeter-wave radar. The vehicle Ego is on a non-elevated road and islocated in a crossroad region. In step 102, the vehicle Ego identifiesthree moving targets, a vehicle A, a vehicle B, and a vehicle C. Thevehicle Ego is used as an ego vehicle, and the vehicle Ego tracksmovement tracks of the vehicle A, the vehicle B, and the vehicle C usingthe sensor. A vehicle body coordinate system in which the vehicle Ego isused as an origin is shown in FIG. 21. An X axis is Veh_X, and a Y axisis Veh_Y. In the vehicle body coordinate system, the movement track ofthe vehicle A is a curved dashed line A′-A, the movement track of thevehicle B is a curved dashed line B′-B, and the movement track of thevehicle C is a curved dashed line C′-C. The vehicle A is used as anexample. In the vehicle body coordinate system, within the time periodT, coordinates of a start point A′ of the moving target vehicle A is(X_(veh) ⁰, Y_(veh) ⁰), and coordinates of an end point A is (X_(veh)^(T), Y_(veh) ^(T)) A slope k_(A) of the movement track of the movingtarget vehicle A is calculated according to the method described in stepS105. Therefore, slopes k_(B) and k_(C) of the movement tracks of themoving target vehicles B and C are separately calculated.

As shown in FIG. 22, a vehicle Ego is the foregoing terminal device, andmay be mounted with a sensor, for example, a millimeter-wave radar. Thevehicle Ego is on an elevated road and is located in a ramp intersectionregion. In step 102, the vehicle Ego identifies two moving targets, avehicle D and a vehicle E. The vehicle Ego is used as an ego vehicle,and the vehicle Ego tracks movement tracks of the vehicle D and thevehicle E using the sensor. A vehicle body coordinate system in whichthe vehicle Ego is used as an origin is shown in FIG. 22. An X axis isVeh_X, and a Y axis is Veh_Y. In the vehicle body coordinate system, themovement track of the vehicle D is a curved dashed line D′-D, and themovement track of the vehicle E is a curved dashed line E′-E. Thevehicle D is used as an example. In the vehicle body coordinate system,within the time period T, coordinates of a start point D′ of the movingtarget vehicle D is (X_(veh) ⁰, Y_(veh) ⁰), and coordinates of an endpoint D is (X_(veh) ^(T), Y_(veh) ^(T)). A slope k_(B) of the movementtrack of the moving target vehicle D is calculated according to themethod described in step S105.

Optionally, the feature of the moving target may alternatively beobtained through calculation based on the slope of the movement track.The feature of the moving target may be a maximum slope of slopes ofmovement tracks of a plurality of moving targets, or a minimum slope ofthe slopes of the movement tracks of the plurality of moving targets, oran average value of the slopes of the movement tracks of the pluralityof moving targets.

S402: Determine whether the speed of the moving target is greater than afourth threshold.

It is determined whether the average value of the speeds of theplurality of moving objects in the transverse direction, namely, theVeh_Y axis direction of the vehicle body coordinate system, is greaterthan the threshold:

|Vel _(veh) _(y) |>Th _(Vel) _(y)

Th_(Vel) _(y) is a threshold of a speed at which the moving targettransversely passes the terminal device, and is referred to as thefourth threshold. When Vel_(veh) _(y) is greater than the fourththreshold Th_(Vel) _(y) , the moving target moves greatly along thetransverse direction. Therefore, it is determined that the intersectionat which the terminal device is located is a crossroad under theelevated road, namely, the intersection of the non-elevated road, andthat the type of the road at which the terminal device is located is thenon-elevated road. When Vel_(eh) is less than or equal to the fourththreshold Th_(Vel) _(y) , S403 may be performed to continue processing.

${k_{i} = \frac{X_{veh}^{T} - X_{veh}^{0}}{Y_{veh}^{T} - Y_{veh}^{0}}}{k_{\min} = {\min\left\{ k_{i} \right\}\left( {{i = 1},2,\ldots,M_{tracked}} \right)}}$

A slope k_(i) of a connecting line between a start point and an endpoint of an i^(th) tracking target in the vehicle body coordinate systemat the time point t is calculated. Each object successfully traced istraversed, and a minimum slope k_(min) of slopes of connecting linesbetween start points and end points of all traced objects in the vehiclebody coordinate system is obtained.

S403: Determine whether the slope of the movement track of the movingtarget meets a condition.

Optionally, whether the slope of the movement track of the moving targetis greater than a threshold is determined. If the slope of the movementtrack of the moving target is greater than the threshold, it isdetermined that the type of the road on which the terminal device islocated is the non-elevated road. If the slope of the movement track ofthe moving target is less than or equal to the threshold, step S404 maybe performed to continue determining, or it is determined that the typeof the road on which the terminal device is located is the elevatedroad.

Optionally, it is determined whether an absolute value of the minimumslope of the slopes of the movement tracks of the moving objects is lessthan a fifth threshold.

|k _(min) |<Th _(k)

In the foregoing formula, whether the minimum slope of the slopes of themovement tracks is less than the fifth threshold Th_(k) is determined,where Th_(k) is a threshold of the slope of the movement track of themoving target that transversely passes the terminal device. When theabsolute value of k_(min) is less than the fifth threshold Th_(k), atleast one moving target transversely passes in front of the terminaldevice, and it is determined that the road on which the terminal deviceis located is a non-elevated road. If the absolute value of k_(min) isgreater than or equal to the threshold Th_(k), step S404 may beperformed to continue determining, or it is determined that the type ofthe road on which the terminal device is located is the elevated road.

Optionally, it is determined whether an absolute value of the maximumslope of the slopes of the movement tracks of the moving targets isgreater than a threshold.

The M moving targets are traversed, where M is an integer greater than0, i is an integer greater than 0, and i is less than or equal to M. Themaximum slope k_(max) of slopes of connecting lines between start pointsand end points of the M moving objects in the vehicle body coordinatesystem is obtained.

k _(max)=max{k _(i)} (i=1,2, . . . ,M)

|k _(max) |>Th _(k)

In the foregoing formula, whether the maximum slope of the slopes of themovement tracks is greater than the threshold Th_(k) is determined,where Th_(k) is the threshold of the slope of the movement track of themoving target that transversely passes the terminal device. When theabsolute value of k_(max) is greater than the threshold Th_(k), at leastone moving target transversely passes in front of the terminal device,and it is determined that the road on which the terminal device islocated is a non-elevated road. The threshold Th_(k) is obtained bycollecting statistics on the slope of the movement track of the vehiclewhen the vehicle transversely crosses the intersection region of thenon-elevated road. The threshold may be set to 1. If the absolute valueof k_(max) is less than or equal to the threshold Th_(k), step S404 maybe performed to continue determining, or it is determined that the typeof the road on which the terminal device is located is the elevatedroad.

The type of the intersection at which the terminal device is located isdetermined based on the feature parameter of the road divider, and thetype of the intersection may correspond to the type of the road at whichthe intersection is located. For example, the type of the intersectionmay be the intersection of the elevated road or the intersection of thenon-elevated road. When it is determined that the type of theintersection at which the terminal device is located is the intersectionof the elevated road, it is determined that the type of the road onwhich the terminal device is located is the elevated road.

According to the positioning method provided in the embodiments of thisapplication, based on the road feature detected by the millimeter-waveradar, the action of entering or leaving a ramp is identified and a roadintersection scenario is identified, to effectively determine a currentroad and increase road matching precision, so as to increase positioningprecision. An inner ring in Shanghai is used as an example, positioningprecision of the present disclosure is increased from 72% ofconventional road matching to 92%. In addition, the method may beapplicable to an elevated region, and accurate positioning precision canalso be provided in the road stacking scenario. The present disclosuredoes not depend on a slope assumption, and can be used in more urbanelevated road scenarios. The present disclosure, a vehicle can bedetermined as long as the vehicle crosses an intersection, and real-timeperformance of matching is better. In this application, map matching isperformed using a low-cost and widely commercial road-level navigationmap, and dependence on prior information is low. Hardware dependency ofthe present disclosure is a common GNSS system and the millimeter-waveradar. The foregoing devices are easy to obtain on a vehicle equippedwith an automatic/semi-automatic driving function, and are easy to becommercially promoted subsequently.

After the terminal device is positioned according to the positioningmethod provided in the embodiments of this application, the correctedcoordinates of the terminal device are obtained, and a positioning errormay be calculated based on a distance between the corrected coordinatesand the original coordinates. A positioning precision prior map withpositioning precision information is calculated based on positioningerrors corresponding to a plurality of times of positioning. Thefollowing steps may be included.

S501: Classify track points.

The track point is a location represented by original positioningcoordinates of the terminal device. After track data obtained throughthe plurality of times of positioning is obtained, each track point hasan ID of an optimally matched road and a matching degree that areobtained according to the positioning method provided in the embodimentsof this application. If the matching degree is greater than a threshold,the track point is reserved. If the matching degree is less than orequal to the threshold, the track point is eliminated. The track pointsare grouped based on the ID of the optimally matched road. If analysisobjects are N roads, there are N groups of track data, where N is aninteger greater than 0.

S502: Perform cluster analysis

For an i^(th) road, spatial interpolation is performed on track pointsof the road based on positioning precision using a spatial analysismethod, to obtain a grid map of positioning precision. A value of eachgrid indicates positioning precision of a corresponding region.

As shown in FIG. 23, FIG. 23 is a spatially interpolated positioningprecision prior map obtained based on a plurality of pieces of offlinetrack data after a plurality of times of traveling in the inner ring inShanghai. A deeper color indicates a larger positioning error and lowerprecision of the region, and a lighter color indicates higher precisionof the region.

Further, in this application, the map may be further divided into threeregions based on the positioning precision prior map and the positioningprecision, a buffer zone of a dead zone, the dead zone, and a non-deadzone. The dead zone is a grid zone whose positioning precision of thepositioning precision prior map is less than a threshold Th_(dead).

a: Phase of Entering the Buffer Zone of the Dead Zone

As shown in FIG. 24, a zone in which a vertical projection distance froma vehicle to a dead zone edge grid is less than D_(dead_buffer) is thebuffer zone of the dead zone. Positioning precision of the buffer zoneof the dead zone is not very low, and a positioning result is still in atrusted range. Original positioning coordinates are used as anchorP_(anchor) coordinates, and the anchor coordinates are used as theoriginal coordinates in the positioning method provided in theembodiments of this application. An ID of an optimally matched road isoutput as a target road Road_(traget).

b: Phase of Entering the Dead Zone

Positioning precision of the dead zone may have a relatively largedeviation. In the present disclosure, in the phase at which the vehicleenters the dead zone, an anchor point of the buffer zone of the deadzone is used as a start point, and a forward speed and an angular speedof the vehicle are used to perform dead reckoning, to obtain a deadreckoning result P_(DR). Then, the dead reckoning result P_(DR) is usedas the original coordinates in the positioning method provided in theembodiments of this application, and the target road Road_(traget)output in the phase a and a road topologically connected toRoad_(traget) are used as candidate roads for input. According to thepositioning method provided in the embodiments of this application, theoptimally matched road is obtained, and the P_(DR) is projected to aroad of the navigation map, to obtain a projected point P_(Proj) as apositioning result in this case.

c: Phase of Leaving the Dead Zone

When the vehicle leaves the dead zone and a positioning deviation iswithin an acceptable range, a GNSS result may be directly used or a GNSSpositioning result may be used as the original coordinates for input,and a matched road and coordinates of a projected point projected to theroad are output.

An embodiment of this application further provides an electronic device.The electronic device includes an obtaining module, a featurecalculation module, a selection module, and a road matching module. Theobtaining module may be configured to perform the foregoing steps S1 andS101. The feature calculation module may be configured to perform theforegoing steps S2, S102 to S105, S301, S401, and S404. The selectionmodule may be configured to perform the foregoing steps S3, S200 toS204, S302 and S303, S402, and S405 to S407. The road matching modulemay be configured to perform the foregoing step S4. The obtaining moduleis configured to obtain coordinates of a terminal device, data of aplurality of collection points of a road divider, and features of aplurality of candidate roads. The plurality of candidate roads are roadsthat are in map data and that are located in a first range of thecoordinates of the terminal device. The road divider is an edge of aroad on which the terminal device is located, and the plurality ofcollection points of the road divider are collection points obtainedwhen a sensor collects the road divider.

The feature calculation module is configured to calculate, based on thedata of the plurality of collection points of the road divider, afeature of the road on which the terminal device is located. The featureof the road on which the terminal device is located is used to indicatea change in a shape of the road on which the terminal device is located.

The selection module is configured to select a target road from theplurality of candidate roads based on the feature of the road on whichthe terminal device is located and the features of the plurality ofcandidate roads.

The road matching module is configured to match the coordinates of theterminal device to the target road, to obtain corrected coordinates ofthe terminal device.

Optionally, the selection module is further configured to determine,based on the feature of the road on which the terminal device islocated, a type of the road on which the terminal device is located, andselect the target road from the plurality of candidate roads based onthe type of the road on which the terminal device is located and typesof the plurality of candidate roads.

Optionally, the selection module is further configured to determine,based on the feature of the road on which the terminal device islocated, a type of an intersection at which the terminal device islocated. The type of the intersection is an intersection of an elevatedroad or an intersection of a non-elevated road, and the intersection atwhich the terminal device is located is an intersection at which theterminal device is currently located.

Optionally, the selection module is further configured to, if thefeature of the road on which the terminal device is located meets apreset threshold, determine the type of the intersection at which theterminal device is located. The type of the intersection is theintersection of the elevated road or the intersection of thenon-elevated road.

Optionally, the obtaining module is further configured to obtaincoordinates that are of one or more moving objects and that arecollected by the sensor. The coordinates of the moving object arecoordinates of the moving object relative to the sensor.

The feature calculation module is further configured to calculate amovement feature of the one or more moving targets based on thecoordinates of the one or more moving targets, where the movementfeature is used to indicate a movement state of the moving target.

The selection module is further configured to determine, based on themovement feature of the one or more moving targets and the feature ofthe road on which the terminal device is located, the type of the roadon which the terminal device is located.

Optionally, the feature of the road on which the terminal device islocated further includes a quantity of lanes of the road on which theterminal device is located. The selection module is further configuredto determine, based on the quantity of lanes of the road on which theterminal device is located, whether the terminal device enters or leavesthe intersection of the elevated road, and if the terminal device entersor leaves the intersection of the elevated road, determine that the typeof the road on which the terminal device is located is the elevatedroad.

Optionally, the selection module is further configured to calculate amatching degree between each of the plurality of roads and thecoordinates of the terminal device. A matching degree of a road that isin the plurality of roads and that has a same type as the road on whichthe terminal device is located is greater than a matching degree of aroad that is in the plurality of roads and that has a different typefrom the road on which the terminal device is located, and the targetroad is a road that is in the plurality of roads and that has a highestdegree of matching with the coordinates of the terminal device.

Optionally, the selection module is further configured to, if thefeature of the road on which the terminal device is located is less thana first threshold, determine that the type of the intersection at whichthe terminal device is located is the intersection of the elevated road.

Optionally, the selection module is further configured to, if thefeature of the road on which the terminal device is located is greaterthan a second threshold, determine that the type of the intersection atwhich the terminal device is located is the intersection of thenon-elevated road.

Optionally, the movement feature of the one or more moving targets is amovement speed of the one or more moving targets. The selection moduleis further configured to, if the movement speed of the one or moremoving targets is greater than a fourth threshold, determine that thetype of the intersection at which the terminal device is located is theintersection of the non-elevated road.

Optionally, the movement feature of the one or more moving targets is aslope of a movement track of the one or more moving targets. Theselection module is further configured to, if the slope of the movementtrack of the one or more moving targets is less than a fifth threshold,determine that the intersection at which the terminal device is locatedis the intersection of the non-elevated road.

Optionally, the feature of each of the plurality of candidate roadsincludes a quantity of lanes of each of the plurality of candidateroads. The selection module is further configured to, if the quantity oflanes of the road on which the terminal device is located is greaterthan the quantity of lanes of each of the plurality of candidate roads,determine that the type of the road on which the terminal device islocated is the elevated road.

Optionally, the obtaining module is further configured to obtain courseangles of the terminal device at a plurality of moments. The selectionmodule is further configured to, if a variance of the course angles ofthe terminal device at the plurality of moments is greater than a sixththreshold, determine, based on the quantity of lanes of the road onwhich the terminal device is located, whether the terminal device entersor leaves the intersection of the elevated road.

Based on the foregoing embodiments, an embodiment of this applicationfurther provides a chip subsystem (SOC). The chip subsystem includes anapplication processor and a GPS module configured to receive apositioning signal. The application processor may implement thepositioning method provided in any one or more of the foregoingembodiments. The GPS module may be an independent chip, or may beintegrated with the application processor.

Based on the foregoing embodiments, an embodiment of this applicationfurther provides an electronic device. The electronic device includesthe foregoing chip subsystem and a sensor such that the electronicdevice can implement the positioning method provided in any one or moreof the foregoing embodiments. The sensor is configured to collect dataof a road divider and coordinates of one or more moving targets.

Based on the foregoing embodiments, an embodiment of this applicationfurther provides a positioning chip, for example, a GPS chip. The chipincludes a radio frequency module and a processing module. The radiofrequency module is configured to receive a positioning signal, and theprocessing module is configured to implement the positioning methodprovided in any one or more of the foregoing embodiments.

Based on the foregoing embodiments, an embodiment of this applicationfurther provides an electronic device. The electronic device includesthe foregoing positioning chip and a sensor such that the electronicdevice can implement the positioning method provided in any one or moreof the foregoing embodiments. The sensor is configured to collect dataof a road divider and coordinates of one or more moving targets.

Based on the foregoing embodiments, an embodiment of this applicationfurther provides a computer storage medium. The storage medium storescomputer instructions, and when the computer instructions are read andexecuted by one or more processors, the positioning method provided inany one or more of the foregoing embodiments may be implemented. Thecomputer storage medium may include any medium that can store programcode or computer instructions, for example, a Universal Serial Bus (USB)flash drive, a removable hard disk, a read-only memory, a RAM, amagnetic disk, or an optical disc.

Based on the foregoing embodiments, this application provides a computerprogram product, where the computer program product includes a computerinstruction, and when a processor executes the computer instruction, theprocessor is enabled to perform the positioning method provided in anyone or more of the foregoing embodiments.

A person skilled in the art should understand that the embodiments ofthis application may be provided as a method, a system, or a computerprogram product. Therefore, this application may use a form of hardwareonly embodiments, software only embodiments, or embodiments with acombination of software and hardware. Moreover, this application may usea form of a computer program product that is implemented on one or morecomputer-usable storage media (including but not limited to a diskmemory, a compact disc (CD)-ROM, an optical memory, and the like) thatinclude computer-usable program code.

This application is described with reference to the flowcharts and/orblock diagrams of the method, the device (system), and the computerprogram product according to this application. It should be understoodthat computer program instructions may be used to implement each processand/or each block in the flowcharts and/or the block diagrams and acombination of a process and/or a block in the flowcharts and/or theblock diagrams. These computer program instructions may be provided fora general-purpose computer, a special-purpose computer, an embeddedprocessor, or a processor of another programmable data processing deviceto generate a machine such that the instructions executed by a computeror the processor of the other programmable data processing devicegenerate an apparatus for implementing a specific function in one ormore processes in the flowcharts and/or in one or more blocks in theblock diagrams.

These computer program instructions may alternatively be stored in acomputer-readable memory that can indicate the computer or the otherprogrammable data processing device to work in a specific manner suchthat the instructions stored in the computer-readable memory generate anartifact that includes an instruction apparatus. The instructionapparatus implements a specific function in one or more processes in theflowcharts and/or in one or more blocks in the block diagrams.

These computer program instructions may alternatively be loaded to acomputer or another programmable data processing device such that aseries of operations and steps are performed on the computer or theother programmable device, to generate computer-implemented processing.Therefore, the instructions executed on the computer or the otherprogrammable device provide steps for implementing a specific functionin one or more processes in the flowcharts and/or in one or more blocksin the block diagrams.

Obviously, a person skilled in the art can make various modificationsand variations to this application without departing from the scope ofthis application. This application is intended to cover thesemodifications and variations of this application provided that they fallwithin the scope of protection defined by the following claims and theirequivalent technologies.

What is claimed is:
 1. A positioning method, comprising: obtaining firstcoordinates of a terminal device, a road feature of a first road onwhich the terminal device is located, and candidate road featuresdescribing features of a plurality of candidate roads, wherein each ofthe plurality of candidate roads is located in a first range of thefirst coordinates, and wherein the road feature is from a sensor of theterminal device and indicates a change in a shape of the first road;selecting a target road from the plurality of candidate roads based onthe road feature and the candidate road features; and matching the firstcoordinates to the target road to obtain corrected coordinates of theterminal device.
 2. The positioning method of claim 1, wherein thecandidate road features comprise candidate road types describing typesof the plurality of candidate roads, and wherein the positioning methodfurther comprises: determining, based on the road feature, a road typedescribing a type of the first road; and further selecting the targetroad from the plurality of candidate roads further based on the roadtype.
 3. The positioning method of claim 2, wherein the road type iselevated or non-elevated, and wherein the candidate road types areelevated or non-elevated.
 4. The positioning method of claim 2, whereinthe terminal device is within an intersection range, wherein thepositioning method further comprises determining, based on the roadfeature, an intersection type describing a type of an intersection atwhich the terminal device is located, and wherein the intersection typeis an elevated road intersection or a non-elevated road intersection. 5.The positioning method of claim 4, wherein the road feature meets apreset threshold, and wherein the positioning method further comprisesdetermining the intersection type.
 6. The positioning method of claim 1,wherein the road feature is based on data of a plurality of collectionpoints of a road divider that is located on an edge of the first road,and wherein the plurality of collection points are collection points atwhich the sensor collects data on the road divider.
 7. The positioningmethod of claim 6, wherein the road feature comprises at least one of afirst average value of slopes of the road divider at the plurality ofcollection points, a first variance of the slopes, a second averagevalue of distances between the plurality of collection points and theterminal device, or a second variance of the distances.
 8. Thepositioning method of claim 1, further comprising: obtaining secondcoordinates of a moving target, wherein the second coordinates arerelative to the sensor; calculating a movement feature of the movingtarget based on the second coordinates, wherein the movement featureindicates a movement state of the moving target; and determining, basedon the movement feature, a road type of the first road.
 9. Thepositioning method of claim 8, wherein the movement feature is at leastone of a movement speed of the moving target or a slope of a movementtrack of the moving target.
 10. The positioning method of claim 1,further comprising calculating a matching degree between each of theplurality of candidate roads and the first coordinates, wherein a firstmatching degree of a first candidate road of the plurality of candidateroads that has a same type as the first road is greater than a secondmatching degree of a second candidate road of the plurality of candidateroads that has a different type from the first road, and wherein thetarget road is one of the plurality of candidate roads that has ahighest degree of matching with the first coordinates.
 11. An electronicdevice, comprising: a sensor configured to obtain a road feature of afirst road on which the electronic device is located, wherein the roadfeature indicates a change in a shape of the first road; and a processorcoupled to the sensor and configured to cause the electronic device tobe configured to: obtain first coordinates of the electronic device, theroad feature of the first road, and candidate road features describingfeatures of a plurality of candidate roads, wherein each of theplurality of candidate roads is located in a first range of the firstcoordinates; select a target road from the plurality of candidate roadsbased on the road feature and the candidate road features; and match thefirst coordinates to the target road to obtain corrected coordinates ofthe electronic device.
 12. The electronic device of claim 11, whereinthe candidate road features comprise candidate road types describingtypes of the plurality of candidate roads, and wherein the processor isfurther configured to cause the electronic device to: determine, basedon the road feature, a road type describing a type of the first road;and select the target road from the plurality of candidate roads furtherbased on the road type.
 13. The electronic device of claim 12, whereinthe road type is elevated or non-elevated, and wherein the candidateroad types are elevated or non-elevated.
 14. The electronic device ofclaim 12, wherein the electronic device is within an intersection range,wherein the processor is further configured to cause the electronicdevice to determine, based on the road feature, an intersection typedescribing a type of an intersection at which the electronic device islocated, and wherein the intersection type is an elevated roadintersection or a non-elevated road intersection.
 15. The electronicdevice according to claim 14, wherein the road feature meets a presetthreshold, and wherein the processor is further configured to determinethe intersection type.
 16. The electronic device of claim 11, whereinthe road feature is based on data of a plurality of collection points ofa road divider that is located on an edge of the first road, and whereinthe plurality of collection points are collection points at which thesensor collects data on the road divider.
 17. The electronic device ofclaim 16, wherein the road feature comprises at least one of a firstaverage value of slopes of the road divider at the plurality ofcollection points, a first variance of the slopes, a second averagevalue of distances between the plurality of collection points and theelectronic device, or a second variance of the distances.
 18. Theelectronic device of claim 11, wherein the processor is furtherconfigured to cause the electronic device to: obtain second coordinatesof a moving target, wherein the second coordinates are relative to thesensor; calculate a movement feature of the moving target based on thesecond coordinates, wherein the movement feature indicates a movementstate of the moving target; and determine, based on the movementfeature, a road type of the first road.
 19. The electronic device ofclaim 18, wherein the movement feature is at least one of a movementspeed of the moving target or a slope of a movement track of the movingtarget.
 20. The electronic device according to claim 11, wherein theprocessor is further configured to calculate a matching degree betweeneach of the plurality of candidate roads and the first coordinates,wherein a first matching degree of a first candidate road of theplurality of candidate roads that has a same type as the first road isgreater than a second matching degree of a second candidate road of theplurality of candidate roads that has a different type from the firstroad, and wherein the target road is one of the plurality of candidateroads that has a highest degree of matching with the first coordinates.